String key = it.next(); SingleSignOnEntry sso = (SingleSignOnEntry) cache.get(key); if (sso.isEmpty() && sso.getLastAccessTime() < tooOld) { removals.add(key);
/** * Remove a single Session from a SingleSignOn. Called when * a session is timed out and no longer active. * * @param ssoId Single sign on identifier from which to remove the session. * @param session the session to be removed. */ protected void removeSession(String ssoId, Session session) { if (logger.isLoggable(Level.FINE)) { logger.fine("Removing session " + session.toString() + " from sso id " + ssoId ); } // Get a reference to the SingleSignOn SingleSignOnEntry entry = lookup(ssoId); if (entry == null) return; // Remove the inactive session from SingleSignOnEntry entry.removeSession(session); // If there are not sessions left in the SingleSignOnEntry, // deregister the entry. if (entry.isEmpty()) { deregister(ssoId); } }
/** * Deregister the specified session. If it is the last session, * then also get rid of the single sign on identifier * * @param ssoId Single sign on identifier * @param session Session to be deregistered */ protected void deregister(String ssoId, Session session) { SingleSignOnEntry sso = lookup(ssoId); if ( sso == null ) return; session.setSsoId(null); session.setSsoVersion(0L); sso.removeSession( session ); // see if we are the last session, if so blow away ssoId if (sso.isEmpty()) { synchronized (cache) { cache.remove(ssoId); } } }