:type session_key:  session_abcs.SessionKey
        :type session: session_abcs.Session
        :type ese: InvalidSessionException
196668
def on_invalidation(self, session_key, session=None, ise=None):
        
        if session:
            super().on_invalidation(session, ise, session_key)

        web_registry = session_key.web_registry

        del web_registry.session_id
895359
def createSessionForKey(self, key, user):
        
        PersistentSession(
            store=self.store,
            sessionKey=key,
            authenticatedAs=user)
727449
def in_resource(cls, session_type):
        
        if cls.resources is AllSessionTypes:
            return True
        return session_type in cls.resources
1087582
def rucaptcha_sesion_key_key
      session_id = session.respond_to?(:id) ? session.id : session[:session_id]
      warning_when_session_invalid if session_id.blank?
      ['rucaptcha-session', session_id].join(':')
    end
1278166
def _check_key(self, key):
        
        if not len(key) == 2:
            raise TypeError('invalid key: %r' % key)
        elif key[1] not in TYPES:
            raise TypeError('invalid datatype: %s' % key[1])
361177
private function sessionBinding($key)
    {
        if (null !== $this->sessionOptions[$key]) {
            if (!\array_key_exists($key, $_SESSION)) {
                $_SESSION[$key] = $this->sessionOptions[$key];
            }
            if ($this->sessionOptions[$key] !== $_SESSION[$key]) {
                throw new SessionException(\sprintf('session bound to %s, we got "%s", but expected "%s"', $key, $_SESSION[$key], $this->sessionOptions[$key]));
            }
        }
    }
352980
def validate_key(self, key):
        
        if not key:
            name = self.__class__.__name__
            msg = "%s response missing %s" % (name, self.key_name)
            raise ValidationException(msg, self)
        elif not isinstance(key, str):
            msg = "Response contains invalid %s type" % self.key_name
            raise ValidationException(msg, type(key))
629642
private void runIndexing(Session upperSession, Tuple tuple) {
		initSession( upperSession );
		try {
			index( upperSession, entity( upperSession, tuple ) );
		}
		catch (Throwable e) {
			errorHandler.handleException( log.massIndexerUnexpectedErrorMessage(), e );
		}
		finally {
			log.debug( "finished" );
		}
	}
337912
function(callback){
			var self = this;
			if(!this.id){
				return process.nextTick(function(){
					callback(new Error("Invalid session ID"));
				});
			}

			options.client.get(options.keyspace + self.id, function(error, resp){
				if(error)
					return callback(error);
				try{
					resp = JSON.parse(resp);
				}catch(e){
					return callback(e);
				}
				extendSession(self, resp);
				callback();
			});
		}
279321
public void sessionExpiryTimeSet(ISession session, long old, long newone) {
        // ArrayList sessionStateObservers = null;

        /*
         * Check to see if there is a non-empty list of sessionStateObservers.
         */
        if (_sessionStateObservers == null || _sessionStateObservers.size() < 1) {
            return;
        }

        // synchronized(_sessionStateObservers) {
        // sessionStateObservers = (ArrayList)_sessionStateObservers.clone();
        // }

        ISessionStateObserver sessionStateObserver = null;
        for (int i = 0; i < _sessionStateObservers.size(); i++) {
            sessionStateObserver = (ISessionStateObserver) _sessionStateObservers.get(i);
            sessionStateObserver.sessionExpiryTimeSet(session, old, newone);
        }
    }
77380
function keysFromRecoverySession(sessions, decryptionKey, roomId) {
    const keys = [];
    for (const [sessionId, sessionData] of Object.entries(sessions)) {
        try {
            const decrypted = keyFromRecoverySession(sessionData, decryptionKey);
            decrypted.session_id = sessionId;
            decrypted.room_id = roomId;
            keys.push(decrypted);
        } catch (e) {
            console.log("Failed to decrypt session from backup");
        }
    }
    return keys;
}
937895
def get_session(self, key):
        
        # a SimpleSession:
        session = self.session_handler.do_get_session(key)
        if (session):
            return self.create_exposed_session(session, key)
        else:
            return None
322614
def get_user_from_session(session_key):
    
    session = Session.objects.get(session_key=session_key)
    session_data = session.get_decoded()
    uid = session_data.get('_auth_user_id')
    user = get_user_model().objects.filter(id=uid).first()  # get object or none
    return user
169316
Key searchSessionKey(Subject subject) throws GSSException{
        /*
        The kerberos session key is not accessible via the JGSS API IBM and 
        Oracle both implement a similar API to make an ExtendedGSSContext
        available.
        
        The older implementation to find the session key is still available as 
        a fallback, but it is not expected, that it works.
        
        From "JCIFS with Kerberos doesn't work on JDK 7":
        
        https://bugs.openjdk.java.net/browse/JDK-8031973:
        
        This is a bug in JCIFS. It seems the SMB packet it generates that 
        includes the AP-REQ token also includes something else that should be 
        encrypted with the *context* session key. The standard GSS-API does not
        provide such a method so it looks up the service ticket in the subject 
        and use its *ticket* session key instead. The context session key is not 
        the ticket session key if sub key is used.
         
        Possible patch: Fix jcifs.smb.Kerb5Context's searchSessionKey() method 
        to call Oracle JDK's 
        ExtendedGSSContext::inquireSecContext(InquireType.KRB5_GET_SESSION_KEY) 
        to get the real session key. The classes are defined in 
        com.sun.security.jgss. 
        */
        
        if (extendedGSSContextClass == null || inquireTypeSessionKey == null
                || inquireSecContext == null || gssContext == null) {
            
            if(log.level > 0 && (! deprecationWarningPrinted)) {
                log.print("WARNING: Kerberos Session Key is extracted from Kerberos Ticket. This is known to be problematic (See: https://bugs.openjdk.java.net/browse/JDK-8031973).");
                deprecationWarningPrinted = true;
            }
            
            MIEName src = new MIEName(gssContext.getSrcName().export());
            MIEName targ = new MIEName(gssContext.getTargName().export());
            for(KerberosTicket ticket: subject.getPrivateCredentials(KerberosTicket.class)) {
                MIEName client = new MIEName(gssContext.getMech(), ticket.getClient().getName());
                MIEName server = new MIEName(gssContext.getMech(), ticket.getServer().getName());
                if (src.equals(client) && targ.equals(server)) {
                    return ticket.getSessionKey();
                }
            }
            return null;
        } else {
            if (extendedGSSContextClass.isAssignableFrom(gssContext.getClass())) {
                try {
                    return (Key) inquireSecContext.invoke(gssContext, new Object[]{inquireTypeSessionKey});
                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
                    log.print("Reflective access to ExtendedGSSContext failed");
                    ex.printStackTrace(log);
                }
            }
            return null;
        }
    }
527317
def validate_session(self, client, session):
        
        if session:
            if session._client is not client:
                raise InvalidOperation(
                    'Can only use session with the MongoClient that'
                    ' started it')
            if session._authset != self.authset:
                raise InvalidOperation(
                    'Cannot use session after authenticating with different'
                    ' credentials')
470176
public SipApplicationSession getApplicationSessionByKey(String applicationSessionKey,
			boolean create, boolean isContainerManaged) {
		if(logger.isDebugEnabled()) {
			logger.debug("getApplicationSessionByKey - applicationSessionKey=" + applicationSessionKey);
		}
		
		if(applicationSessionKey == null) {
			throw new NullPointerException("the given key is null !");
		}
		SipApplicationSessionKey sipApplicationSessionKey = new SipApplicationSessionKey(null, sipContext.getApplicationName(), applicationSessionKey);
		
		MobicentsSipApplicationSession sipApplicationSession = sipContext.getSipManager().getSipApplicationSession(sipApplicationSessionKey, create);
		if(sipApplicationSession == null) {
			return null;
		} else {
			// make sure to acquire this app session and add it to the set of app sessions we monitor in the context of the application
			// to release them all when we exit application code
			sipContext.enterSipApp(sipApplicationSession, null, true, isContainerManaged);
			return sipApplicationSession.getFacade();
		}
	}
782399
def get_real_stored_key(self, session_key):
        
        prefix = settings.SESSION_REDIS_PREFIX
        if not prefix:
            return session_key
        return ':'.join([prefix, session_key])