Marks this session as invalid.
439087
void invalidate() {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "invalidate");
        }

        _sessionInvalidated = true;

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "invalidate");
        }

    }
890208
@Nonnull
  public static EChange safeInvalidateSession (@Nullable final HttpSession aSession)
  {
    if (aSession != null)
    {
      try
      {
        if (LOGGER.isDebugEnabled ())
          LOGGER.debug ("Invalidating session " + aSession.getId ());
        aSession.invalidate ();
        return EChange.CHANGED;
      }
      catch (final IllegalStateException ex)
      {
        // session already invalidated
      }
    }
    return EChange.UNCHANGED;
  }
1305386
public void invalidate() throws IOException {
        if (roles!=null) {
            roles = null;
            timestamp = System.currentTimeMillis();
            user.save();
        }
    }
1021155
public void invalidate(String sessionId) {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            StringBuffer sb = new StringBuffer("for app ").append(_sap.getAppName()).append(" id ").append(sessionId);
            LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[INVALIDATE], sb.toString());
        }
        ISession iSess = _coreHttpSessionManager.getISession(sessionId);

        if (iSess != null) {
            IStore iStore = _coreHttpSessionManager.getIStore();
            try {
                iStore.setThreadContext();
                synchronized (iSess) { // START PM47941
                    if (iSess.isValid()) {
                        iSess.invalidate();
                    }
                } // END PM47941
            } finally {
                iStore.unsetThreadContext();
            }
        }
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[INVALIDATE]);
        }
    }
696888
public function handleSessionValidation(SymfonySession $session)
    {
        $request_ip = (string) $this->ipService->getRequestIPAddress();

        $invalidate = false;

        $ip = $session->get('CLIENT_REMOTE_ADDR');
        $agent = $session->get('CLIENT_HTTP_USER_AGENT');
        $request_agent = $this->request->server->get('HTTP_USER_AGENT');

        // Validate against the current uOnlineCheck. This will determine if the user has been inactive for too long.
        if ($this->shouldValidateUserActivity($session)) {
            $threshold = $this->getUserActivityThreshold();
            if ((time() - $session->get('uOnlineCheck')) > $threshold) {
                $this->logger->notice(t('Session Invalidated. Session was inactive for more than %s seconds', $threshold));
                $invalidate = true;
            }
        }

        // Validate against the `valid_since` config item
        $validSinceTimestamp = (int) $this->config->get(AutomatedLogout::ITEM_SESSION_INVALIDATE);

        if ($validSinceTimestamp) {
            $validSince = Carbon::createFromTimestamp($validSinceTimestamp, 'utc');
            $created = Carbon::createFromTimestamp($session->getMetadataBag()->getCreated());

            if ($created->lessThan($validSince)) {
                $this->logger->notice('Session Invalidated. Session was created before "valid_since" setting.');
                $invalidate = true;
            }
        }

        // Validate the request IP
        if ($this->shouldCompareIP() && $ip && $ip != $request_ip) {
            if ($this->logger) {
                $this->logger->notice(
                    'Session Invalidated. Session IP "{session}" did not match provided IP "{client}".',
                    [
                        'session' => $ip,
                        'client' => $request_ip,
                    ]
                );
            }

            $invalidate = true;
        }

        // Validate the request user agent
        if ($this->shouldCompareAgent() && $agent && $agent != $request_agent) {
            if ($this->logger) {
                $this->logger->notice(
                    'Session Invalidated. Session user agent "{session}" did not match provided agent "{client}"',
                    [
                        'session' => $agent,
                        'client' => $request_agent,
                    ]
                );
            }

            $invalidate = true;
        }

        if ($invalidate) {
            $session->invalidate();
        } else {
            if (!$ip && $request_ip) {
                $session->set('CLIENT_REMOTE_ADDR', $request_ip);
            }

            if (!$agent && $request_agent) {
                $session->set('CLIENT_HTTP_USER_AGENT', $request_agent);
            }
        }

        return $invalidate;
    }
322570
public final void invalidateSession(RaftGroupId groupId, long id) {
        SessionState session = sessions.get(groupId);
        if (session != null && session.id == id) {
            sessions.remove(groupId, session);
        }
    }
752367
public void validateComponents ()
    {
        // swap out our invalid array
        Object[] invalid = null;
        synchronized (this) {
            invalid = _invalid;
            _invalid = null;
        }

        // if there's nothing to validate, we're home free
        if (invalid == null) {
            return;
        }

        // validate everything therein
        int icount = invalid.length;
        for (int ii = 0; ii < icount; ii++) {
            if (invalid[ii] != null) {
                if (DEBUG) {
                    log.info("Validating " + invalid[ii]);
                }
                ((Component)invalid[ii]).validate();
            }
        }
    }
463172
public synchronized void invalidate(boolean appInvoked) {
        if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[INVALIDATE], appInvoked);
        }
        getSwappableListeners(BackedSession.HTTP_SESSION_BINDING_LISTENER);
        if (appInvoked && (!invalInProgress) && isValid())
            _storeCallback.sessionCacheDiscard(this);
        super.invalidate();
        //The session will be invalid, but do we need to worry about these in case we are already processing this session somewhere else?
        if (this.appDataChanges != null)
            this.appDataChanges.clear();
        if (this.appDataRemovals != null)
            this.appDataRemovals.clear();
        this.update = null;
        this.userWriteHit = false;
        this.maxInactWriteHit = false;
        this.listenCntHit = false;
        setSwappableData(null);
        this.mNonswappableData = null;
        if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[INVALIDATE]);
        }
    }
995724
public void destroySession() {
    	JsonObject session = get("session");
        if (session == null) {
            return;
        }

        String sessionId = session.getString("id");
        // remove from the context
        put("session", null);

        if (sessionId == null) {
            return;
        }

        store.destroy(sessionId, new Handler<Object>() {
            @Override
            public void handle(Object error) {
                if (error != null) {
                    // TODO: better handling of errors
                    System.err.println(error);
                }
            }
        });
    }
144046
def clear(self, session):
        
        try:
            sess = self.sessions[session]
        except KeyError:
            return constants.StatusCode.error_invalid_object
        return sess.clear()
923532
protected boolean checkValid() throws InvalidItemStateException
   {
      try
      {
         session.checkLive();
      }
      catch (RepositoryException e)
      {
         throw new InvalidItemStateException("This kind of operation is forbidden after a session.logout().", e);
      }

      if (data == null)
      {
         throw new InvalidItemStateException("Invalid item state. Item was removed or discarded.");
      }

      session.updateLastAccessTime();
      return true;
   }
1244885
public void internalInvalidate(boolean timeoutOccurred) {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[INTERNAL_INVALIDATE], appNameAndIdString);
        }
        //if it's not valid, just return
        if (_isValid) {
            //sets the Thread's context (classLoader) so that we can handle app specific listeners
            try {
                _store.setThreadContext();
                // PM11279: Call callInvalidateFromInternalInvalidate, which is overridden in MTMSesion
                callInvalidateFromInternalInvalidate();
                if (timeoutOccurred) {
                    _storeCallback.sessionInvalidatedByTimeout(this);
                }
            } finally {
                _store.unsetThreadContext();
            }
        }
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[INTERNAL_INVALIDATE]);
        }
    }
1170969
public void validate() throws InvalidPropertyException {

        final String methodName = "validate";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName);
        }

        final List<String> failedPropsMessages = new ArrayList<String>();
        final List<PropertyDescriptor> invalidProperties = new ArrayList<PropertyDescriptor>();

        try {

            if (isSet(_destinationName))
            {
                // BusName must be set
                if (!isSet(_busName)) {

                    if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                        SibTr.debug(this, TRACE, "Invalid BusName - BusName was "
                                                 + _busName);
                    }
                    failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_BUSNAME_CWSIV0504"),
                                                                    null, null));
                    invalidProperties.add(new PropertyDescriptor("BusName",
                                    SibRaActivationSpec.class));

                }

                // DestinationType must be valid
                if (!DESTINATION_TYPES.keySet().contains(_destinationType)) {

                    if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                        SibTr.debug(this, TRACE,
                                    "Invalid Destination Type - We expected a destination type of "
                                                    + DESTINATION_TYPE_QUEUE + " or " + DESTINATION_TYPE_TOPIC_SPACE + " or "
                                                    + DESTINATION_TYPE_PORT + " or " + DESTINATION_TYPE_SERVICE
                                                    + " but we got "
                                                    + _destinationType);
                    }

                    failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_DESTINATION_TYPE_CWSIV0505"),
                                                                    new Object[] { DESTINATION_TYPE_QUEUE,
                                                                                  DESTINATION_TYPE_TOPIC_SPACE,
                                                                                  DESTINATION_TYPE_PORT,
                                                                                  DESTINATION_TYPE_SERVICE,
                                                                                  _destinationType }, null));
                    invalidProperties.add(new PropertyDescriptor(
                                    "DestinationType", SibRaActivationSpec.class));

                }

                // Make sure we are not using a topic space if wildcarded destinations are used.
                if ((Boolean.TRUE.equals(_useDestinationWildcard))
                    && (DESTINATION_TYPE_TOPIC_SPACE.equals(_destinationType)))
                {
                    failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_USEDESTWILDCARD_CWSIV0515"),
                                                                    null, null));
                    invalidProperties.add(new PropertyDescriptor(
                                    "UseDestinationWildcard",
                                    SibRaActivationSpec.class));
                }

                // For durable subscriptions...
                if ((DESTINATION_TYPE_TOPIC_SPACE.equals(_destinationType))
                    && (isSet(_subscriptionName))) {

                    // ShareDurableSubscriptions must be valid
                    if (!SUBSCRIPTION_SHAREABILITY.keySet().contains(
                                                                     _shareDurableSubscriptions)) {

                        if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                            SibTr.debug(this, TRACE,
                                        "Invalid shareDurableSubscriptions - We expect a value of "
                                                        + SibRaDurableSubscriptionSharing.ALWAYS + ", "
                                                        + SibRaDurableSubscriptionSharing.NEVER + " or "
                                                        + SibRaDurableSubscriptionSharing.CLUSTER_ONLY + " but we got "
                                                        + _shareDurableSubscriptions);
                        }
                        failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_SHARE_DURSUB_CWSIV0506"),
                                                                        new Object[] { SibRaDurableSubscriptionSharing.ALWAYS,
                                                                                      SibRaDurableSubscriptionSharing.NEVER,
                                                                                      SibRaDurableSubscriptionSharing.CLUSTER_ONLY,
                                                                                      _shareDurableSubscriptions },
                                                                        null));

                        invalidProperties.add(new PropertyDescriptor(
                                        "ShareDurableSubscriptions",
                                        SibRaActivationSpec.class));

                    }

                    // DurableSubscriptionHome must be set
                    if (!isSet(_durableSubscriptionHome)) {

                        failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_DURSUBHOME_CWSIV0507"),
                                                                        null, null));
                        invalidProperties.add(new PropertyDescriptor(
                                        "DurableSubscriptionHome",
                                        SibRaActivationSpec.class));

                    }

                }

            } else {

                // DestinationType must be valid and not a topic space
                if (!DESTINATION_TYPES.keySet().contains(_destinationType)
                    || DESTINATION_TYPE_TOPIC_SPACE
                                    .equals(_destinationType)) {

                    if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                        SibTr.debug(this, TRACE,
                                    "Invalid Destination Type - No destination was specified so we expected a destination type of "
                                                    + DESTINATION_TYPE_QUEUE + " or " + DESTINATION_TYPE_PORT + " or "
                                                    + DESTINATION_TYPE_SERVICE + " but we got "
                                                    + _destinationType);
                    }

                    failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_DESTINATION_TYPE_CWSIV0508"),
                                                                    new Object[] { DESTINATION_TYPE_QUEUE,
                                                                                  DESTINATION_TYPE_PORT,
                                                                                  DESTINATION_TYPE_SERVICE,
                                                                                  _destinationType }, null));
                    invalidProperties.add(new PropertyDescriptor(
                                    "DestinationType", SibRaActivationSpec.class));

                }

            }

            // MaxBatchSize must be an Integer greater than zero
            if ((_maxBatchSize == null) || (_maxBatchSize.intValue() < 1)) {

                failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_MAXBATCH_CWSIV0509"),
                                                                null, null));
                invalidProperties.add(new PropertyDescriptor("MaxBatchSize",
                                SibRaActivationSpec.class));

            }

            // MessageDeletionMode must be valid
            if (!MESSAGE_DELETION_MODES.keySet().contains(_messageDeletionMode)) {

                if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                    SibTr.debug(this, TRACE,
                                "Invalid Message Deletion Mode we expected a mode of "
                                                + SibRaMessageDeletionMode.SINGLE + " or "
                                                + SibRaMessageDeletionMode.BATCH + " or "
                                                + SibRaMessageDeletionMode.APPLICATION + " but we got "
                                                + _messageDeletionMode);
                }

                failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_DELETION_MODE_CWSIV0510"),
                                                                new Object[] { SibRaMessageDeletionMode.SINGLE,
                                                                              SibRaMessageDeletionMode.BATCH,
                                                                              SibRaMessageDeletionMode.APPLICATION,
                                                                              _messageDeletionMode }, null));
                invalidProperties.add(new PropertyDescriptor(
                                "MessageDeletionMode", SibRaActivationSpec.class));

            }

            // MaxConcurrency must be an Integer greater than zero
            if ((_maxConcurrency == null) || (_maxConcurrency.intValue() < 1)) {

                failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_MAXCONC_CWSIV0511"),
                                                                null, null));
                invalidProperties.add(new PropertyDescriptor("MaxConcurrency",
                                SibRaActivationSpec.class));

            }

            /**
             * For the target set of properties, use the defaults if none specified
             */

            if ("".equals(_targetType)) {

                _targetType = JmsraConstants.DEFAULT_TARGET_TRANSPORT;

            }

            if ("".equals(_target)) {

                _target = JmsraConstants.DEFAULT_TARGET;

            }

            // Target type must be one of the predefined values
            if ((null == _targetType) || ("".equals(_targetType))) {

                _targetType = JmsraConstants.DEFAULT_TARGET_TYPE;

            } else {

                if (!((ApiJmsConstants.TARGET_TYPE_BUSMEMBER.equals(_targetType)) ||
                      (ApiJmsConstants.TARGET_TYPE_ME.equals(_targetType)) || (ApiJmsConstants.TARGET_TYPE_CUSTOM.equals(_targetType)))) {

                    failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_TARGET_TYPE_CWSIV0512"),
                                                                    new Object[] { ApiJmsConstants.TARGET_TYPE_BUSMEMBER,
                                                                                  ApiJmsConstants.TARGET_TYPE_ME,
                                                                                  ApiJmsConstants.TARGET_TYPE_CUSTOM,
                                                                                  _targetType },
                                                                    null));

                    invalidProperties.add(new PropertyDescriptor(
                                    "targetType",
                                    SibRaActivationSpec.class));

                }

            }

            // Target significance must be one of the predefined values
            if ((null == _targetSignificance) || ("".equals(_targetSignificance))) {

                _targetSignificance = JmsraConstants.DEFAULT_TARGET_SIGNIFICANCE;

            } else {

                if (!((ApiJmsConstants.TARGET_SIGNIFICANCE_PREFERRED.equals(_targetSignificance)) || (ApiJmsConstants.TARGET_SIGNIFICANCE_REQUIRED.equals(_targetSignificance)))) {

                    failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_TARGET_SIGNIFICANCE_CWSIV0513"),
                                                                    new Object[] { ApiJmsConstants.TARGET_SIGNIFICANCE_PREFERRED,
                                                                                  ApiJmsConstants.TARGET_SIGNIFICANCE_REQUIRED,
                                                                                  _targetSignificance },
                                                                    null));
                    invalidProperties.add(new PropertyDescriptor(
                                    "targetSignificance",
                                    SibRaActivationSpec.class));

                }

            }

            if ((_useServerSubject.booleanValue()) && (isSet(_providerEndpoints)))
            {
                failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_PROVIDER_ENDPOINTS_CWSIV0514"),
                                                                new Object[] { _providerEndpoints },
                                                                null));
                invalidProperties.add(new PropertyDescriptor(
                                "providerEndpoints",
                                SibRaActivationSpec.class));
            }

        } catch (final IntrospectionException exception) {

            FFDCFilter.processException(exception, CLASS_NAME + "."
                                                   + methodName, FFDC_PROBE_1, this);
            // Should never happen

        }

        // If we have any invalid properties, throw an
        // InvalidPropertyException
        if (!invalidProperties.isEmpty()) {

            final PropertyDescriptor[] invalidPropertyArray = (PropertyDescriptor[]) invalidProperties
                            .toArray(new PropertyDescriptor[invalidProperties
                                            .size()]);

            if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                SibTr.debug(this, TRACE, "Invalid properties found:",
                            failedPropsMessages);
            }

            final InvalidPropertyException exc = new InvalidPropertyException(
                            NLS.getFormattedMessage(
                                                    ("INVALID_PROPERTIES_CWSIV0501"),
                                                    new Object[] { this, failedPropsMessages }, null));
            exc.setInvalidPropertyDescriptors(invalidPropertyArray);
            throw exc;
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName);
        }

    }
845509
public void onPageEvent(long officialTime) {
		//cleanup expired sessions
		ArrayList garbage = new ArrayList(sessionsMirror.size());
		Iterator i;
		StandardSession session;
		synchronized (sessionsMirror) {
			i = sessionsMirror.values().iterator();
			while (i.hasNext()) {
				session = (StandardSession) i.next();
				if (session.isExpired()) {
					garbage.add(session);
				}
			}
		}
		i = garbage.iterator();
		while (i.hasNext()) {
			session = (StandardSession) i.next();
			System.out.println(new LogEntry("session " + session.getToken() + " expired..."));
			this.destroySessionByToken(session.getToken());
		}
	}
1206339
protected void onBackupWithoutLoadedSession( @Nonnull final String sessionId, @Nonnull final String requestId,
            @Nonnull final BackupSessionService backupSessionService ) {

        if ( !_sessionIdFormat.isValid( sessionId ) ) {
            return;
        }

        try {

            final long start = System.currentTimeMillis();

            final String validityKey = _sessionIdFormat.createValidityInfoKeyName( sessionId );
            final SessionValidityInfo validityInfo = loadSessionValidityInfoForValidityKey( validityKey );
            if ( validityInfo == null ) {
                _log.warn( "Found no validity info for session id " + sessionId );
                return;
            }

            final int maxInactiveInterval = validityInfo.getMaxInactiveInterval();
            final byte[] validityData = encode( maxInactiveInterval, System.currentTimeMillis(),
                    System.currentTimeMillis() );
            // fix for #88, along with the change in session.getMemcachedExpirationTimeToSet
            final int expiration = maxInactiveInterval <= 0 ? 0 : maxInactiveInterval;
            final Future<Boolean> validityResult = _storage.set( validityKey, toMemcachedExpiration(expiration), validityData );
            if ( !_manager.isSessionBackupAsync() ) {
                validityResult.get( _manager.getSessionBackupTimeout(), TimeUnit.MILLISECONDS );
            }

            /*
             * - ping session
             * - ping session backup
             * - save validity backup
             */
            final Callable<?> backupSessionTask = new OnBackupWithoutLoadedSessionTask( sessionId,
                    _storeSecondaryBackup, validityKey, validityData, maxInactiveInterval );
            _executor.submit( backupSessionTask );

            if ( _log.isDebugEnabled() ) {
                _log.debug( "Stored session validity info for session " + sessionId );
            }

            _stats.registerSince( NON_STICKY_ON_BACKUP_WITHOUT_LOADED_SESSION, start );

        } catch( final Throwable e ) {
            _log.warn( "An error when trying to load/update validity info.", e );
        }

    }
1001985
protected void markInvalid()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"markInvalid");
      invalid = true;
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"markInvalid");
   }
377203
protected function validate()
    {
        // Regenerate session if gone too long and reset timers
        if ((time() - $this->get('timer.start', null, 'session') > self::EXPIRE)) {
            session_regenerate_id(true);
            $this->setTimers(true);
        }

        // Destroy session if expired and start a new one
        if ((time() - $this->get('timer.last', null, 'session') > self::EXPIRE)) {
            $this->destroy();
            $this->start();
        }
    }