org.riotfamily.riot.security.session
Class UserHolder

java.lang.Object
  extended by org.riotfamily.riot.security.session.UserHolder
All Implemented Interfaces:
Serializable, EventListener, HttpSessionBindingListener

public class UserHolder
extends Object
implements Serializable, HttpSessionBindingListener

Class that holds a reference to a RiotUser. An instance of this class is stored in the HttpSession. Additionally each instance is placed in a static set which allows us to access/update all currently logged in users.

The class also implements the HttpSessionBindingListener interface and persists the SessionMetaData as soon as the session expires.

Since:
6.5
Author:
Felix Gnass [fgnass at neteye dot de]
See Also:
Serialized Form

Method Summary
 boolean equals(Object obj)
           
 SessionMetaData getSessionMetaData()
           
 RiotUser getUser()
           
 String getUserId()
           
 int hashCode()
           
protected  RiotUser reloadUser(UserLookupAuthenticationService lookupService)
          Reloads the transient user object.
 void valueBound(HttpSessionBindingEvent event)
          Adds itself to the static set of users.
 void valueUnbound(HttpSessionBindingEvent event)
          Removes itself from the static set of users and persists the SessionMetaData.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getUser

public RiotUser getUser()

getUserId

public String getUserId()

getSessionMetaData

public SessionMetaData getSessionMetaData()

valueBound

public void valueBound(HttpSessionBindingEvent event)
Adds itself to the static set of users.

Specified by:
valueBound in interface HttpSessionBindingListener
See Also:
HttpSessionBindingListener.valueBound(HttpSessionBindingEvent)

valueUnbound

public void valueUnbound(HttpSessionBindingEvent event)
Removes itself from the static set of users and persists the SessionMetaData.

Specified by:
valueUnbound in interface HttpSessionBindingListener
See Also:
HttpSessionBindingListener.valueUnbound(HttpSessionBindingEvent)

reloadUser

protected RiotUser reloadUser(UserLookupAuthenticationService lookupService)
Reloads the transient user object.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object