Class AttributeSharingHashSessionIdManager

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.server.session.DefaultSessionIdManager
org.codice.ddf.security.session.AttributeSharingHashSessionIdManager
All Implemented Interfaces:
org.eclipse.jetty.server.SessionIdManager, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle

public class AttributeSharingHashSessionIdManager extends org.eclipse.jetty.server.session.DefaultSessionIdManager
Custom implementation of the SessionIdManager that holds the latest session attributes for all sessions in the Jetty server. This allows AttributeSharingSessionDataStore instances to retrieve these session attributes when a new session is being created in their context for a session that exists in another context.

Note: Needed to hook into Jetty with a SessionIdManager because it's the only way to be notified when a session is invalidated across all contexts. Note: This extends Jetty's impl instead of the abstract class because of a hack in pax-web.

  • Nested Class Summary

    Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container

    org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable

    org.eclipse.jetty.util.component.Dumpable.DumpableContainer

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

    org.eclipse.jetty.util.component.LifeCycle.Listener
  • Field Summary

    Fields inherited from class org.eclipse.jetty.server.session.DefaultSessionIdManager

    __NEW_SESSION_ID, _houseKeeper, _ownHouseKeeper, _random, _reseed, _server, _weakRandom, _workerAttr, _workerName, COUNTER

    Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING

    Fields inherited from interface org.eclipse.jetty.util.component.Dumpable

    KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    AttributeSharingHashSessionIdManager(org.eclipse.jetty.server.Server server)
     
    AttributeSharingHashSessionIdManager(org.eclipse.jetty.server.Server server, Random random)
     
    AttributeSharingHashSessionIdManager(org.eclipse.jetty.server.Server server, org.osgi.framework.BundleContext context)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    protected void
     
    protected void
     
    void
     
    void
     
    protected void
    provideNewSessionAttributes(AttributeSharingSessionDataStore callingDataStore, String id, org.eclipse.jetty.server.session.SessionData sessionData)
    Called by AttributeSharingSessionDataStore when it's storing a session's attributes.
    protected Map<String,Object>
     

    Methods inherited from class org.eclipse.jetty.server.session.DefaultSessionIdManager

    getExtendedId, getId, getRandom, getReseed, getServer, getSessionHandlers, getSessionHouseKeeper, getWorkerName, initRandom, isIdInUse, newSessionId, newSessionId, renewSessionId, setRandom, setReseed, setServer, setSessionHouseKeeper, setWorkerName, toString

    Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle

    addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans

    Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.jetty.util.component.Dumpable

    dumpSelf

    Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer

    isDumpable

    Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle

    addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
  • Constructor Details

    • AttributeSharingHashSessionIdManager

      public AttributeSharingHashSessionIdManager(org.eclipse.jetty.server.Server server, org.osgi.framework.BundleContext context)
    • AttributeSharingHashSessionIdManager

      public AttributeSharingHashSessionIdManager(org.eclipse.jetty.server.Server server)
    • AttributeSharingHashSessionIdManager

      public AttributeSharingHashSessionIdManager(org.eclipse.jetty.server.Server server, Random random)
  • Method Details

    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.eclipse.jetty.server.session.DefaultSessionIdManager
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.eclipse.jetty.server.session.DefaultSessionIdManager
      Throws:
      Exception
    • invalidateAll

      public void invalidateAll(String id)
      Specified by:
      invalidateAll in interface org.eclipse.jetty.server.SessionIdManager
      Overrides:
      invalidateAll in class org.eclipse.jetty.server.session.DefaultSessionIdManager
      See Also:
      • SessionIdManager.invalidateAll(String)
    • expireAll

      public void expireAll(String id)
      Specified by:
      expireAll in interface org.eclipse.jetty.server.SessionIdManager
      Overrides:
      expireAll in class org.eclipse.jetty.server.session.DefaultSessionIdManager
      See Also:
      • SessionIdManager.expireAll(String)
    • addSessionDataStore

      protected void addSessionDataStore(AttributeSharingSessionDataStore dataStore)
    • provideNewSessionAttributes

      protected void provideNewSessionAttributes(AttributeSharingSessionDataStore callingDataStore, String id, org.eclipse.jetty.server.session.SessionData sessionData)
      Called by AttributeSharingSessionDataStore when it's storing a session's attributes. This method will determine if they're different from what's in the cache. If they are different, it will store it and notify all AttributeSharingSessionDataStore instances.
      Parameters:
      callingDataStore - the datastore providing the attributes
      id - the session id
      sessionData - the session attributes
    • sessionAttributes

      protected Map<String,Object> sessionAttributes(String id)