org.jboss.web.tomcat.tc5.sso
Class TreeCacheSSOClusterManager

java.lang.Object
  extended byorg.jboss.web.tomcat.tc5.sso.TreeCacheSSOClusterManager
All Implemented Interfaces:
SSOClusterManager (src) , TreeCacheListener (src)

public final class TreeCacheSSOClusterManager
extends java.lang.Object
implements SSOClusterManager (src) , TreeCacheListener (src)

An implementation of SSOClusterManager that uses a TreeCache to share SSO information between cluster nodes.


Nested Class Summary
static class TreeCacheSSOClusterManager.SSOCredentials (src)
          Private class used to store authentication credentials in the TreeCache.
 
Field Summary
static java.lang.String DEFAULT_GLOBAL_CACHE_NAME
          Default global value for the cacheName property
 
Constructor Summary
TreeCacheSSOClusterManager()
          Creates a new TreeCacheSSOClusterManager
 
Method Summary
 void addLifecycleListener(LifecycleListener listener)
          Add a lifecycle event listener to this component.
 void addSession(java.lang.String ssoId, Session session)
          Notify the cluster of the addition of a Session to an SSO session.
 void cacheStarted(TreeCache (src)  cache)
          Does nothing
 void cacheStopped(TreeCache (src)  cache)
          Does nothing
 LifecycleListener[] findLifecycleListeners()
          Get the lifecycle listeners associated with this lifecycle.
 java.lang.String getCacheName()
           
 ObjectName (src) getCacheObjectName()
           
 ClusteredSingleSignOn (src) getSingleSignOnValve()
          Gets the SingleSignOn valve for which this object is handling cluster communications.
 void logout(java.lang.String ssoId)
          Notifies the cluster that a single sign on session has been terminated due to a user logout.
 org.jboss.web.tomcat.tc5.sso.SingleSignOnEntry lookup(java.lang.String ssoId)
          Queries the cluster for the existence of an SSO session with the given id, returning a SingleSignOnEntry if one is found.
 void nodeCreated(Fqn (src)  fqn)
          Does nothing
 void nodeEvicted(Fqn (src)  fqn)
          Does nothing.
 void nodeLoaded(Fqn (src)  fqn)
          Does nothing
 void nodeModified(Fqn (src)  fqn)
          Extracts an SSO session id from the Fqn and uses it in an invocation of ClusteredSingleSignOn.update().
 void nodeRemoved(Fqn (src)  fqn)
          Extracts an SSO session id from the Fqn and uses it in an invocation of ClusteredSingleSignOn.deregister(String).
 void nodeVisited(Fqn (src)  fqn)
          Does nothing
 void register(java.lang.String ssoId, java.lang.String authType, java.lang.String username, java.lang.String password)
          Notifies the cluster of the creation of a new SSO entry.
 void removeLifecycleListener(LifecycleListener listener)
          Remove a lifecycle event listener from this component.
 void removeSession(java.lang.String ssoId, Session session)
          Notify the cluster of the removal of a Session from an SSO session.
 void setCacheName(java.lang.String objectName)
           
 void setCacheObjectName(ObjectName (src)  objectName)
           
 void setSingleSignOnValve(ClusteredSingleSignOn (src)  valve)
          Sets the SingleSignOn valve for which this object is handling cluster communications.
 void start()
          Prepare for the beginning of active use of the public methods of this component.
 void stop()
          Gracefully terminate the active use of the public methods of this component.
 void updateCredentials(java.lang.String ssoId, java.lang.String authType, java.lang.String username, java.lang.String password)
          Notifies the cluster of an update of the security credentials associated with an SSO session.
 void viewChange(View new_view)
          Does nothing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_GLOBAL_CACHE_NAME

public static final java.lang.String DEFAULT_GLOBAL_CACHE_NAME
Default global value for the cacheName property

See Also:
Constant Field Values (src)
Constructor Detail

TreeCacheSSOClusterManager

public TreeCacheSSOClusterManager()
Creates a new TreeCacheSSOClusterManager

Method Detail

getCacheName

public java.lang.String getCacheName()

setCacheName

public void setCacheName(java.lang.String objectName)
                  throws java.lang.Exception
Throws:
java.lang.Exception

getCacheObjectName

public ObjectName (src)  getCacheObjectName()

setCacheObjectName

public void setCacheObjectName(ObjectName (src)  objectName)
                        throws java.lang.Exception
Throws:
java.lang.Exception

addSession

public void addSession(java.lang.String ssoId,
                       Session session)
Notify the cluster of the addition of a Session to an SSO session.

Specified by:
addSession in interface SSOClusterManager (src)
Parameters:
ssoId - the id of the SSO session
session - the Session that has been added

getSingleSignOnValve

public ClusteredSingleSignOn (src)  getSingleSignOnValve()
Gets the SingleSignOn valve for which this object is handling cluster communications.

Specified by:
getSingleSignOnValve in interface SSOClusterManager (src)
Returns:
the SingleSignOn valve.

setSingleSignOnValve

public void setSingleSignOnValve(ClusteredSingleSignOn (src)  valve)
Sets the SingleSignOn valve for which this object is handling cluster communications.

NOTE: This method must be called before calls can be made to the other methods of this interface.

Specified by:
setSingleSignOnValve in interface SSOClusterManager (src)
Parameters:
valve - a SingleSignOn valve.

logout

public void logout(java.lang.String ssoId)
Notifies the cluster that a single sign on session has been terminated due to a user logout.

Specified by:
logout in interface SSOClusterManager (src)
Parameters:
ssoId -

lookup

public org.jboss.web.tomcat.tc5.sso.SingleSignOnEntry lookup(java.lang.String ssoId)
Queries the cluster for the existence of an SSO session with the given id, returning a SingleSignOnEntry if one is found.

Specified by:
lookup in interface SSOClusterManager (src)
Parameters:
ssoId - the id of the SSO session
Returns:
a SingleSignOnEntry created using information found on another cluster node, or null if no entry could be found.

register

public void register(java.lang.String ssoId,
                     java.lang.String authType,
                     java.lang.String username,
                     java.lang.String password)
Notifies the cluster of the creation of a new SSO entry.

Specified by:
register in interface SSOClusterManager (src)
Parameters:
ssoId - the id of the SSO session
authType - the type of authenticator (BASIC, CLIENT-CERT, DIGEST or FORM) used to authenticate the SSO.
username - the username (if any) used for the authentication
password - the password (if any) used for the authentication

removeSession

public void removeSession(java.lang.String ssoId,
                          Session session)
Notify the cluster of the removal of a Session from an SSO session.

Specified by:
removeSession in interface SSOClusterManager (src)
Parameters:
ssoId - the id of the SSO session
session - the Session that has been removed

updateCredentials

public void updateCredentials(java.lang.String ssoId,
                              java.lang.String authType,
                              java.lang.String username,
                              java.lang.String password)
Notifies the cluster of an update of the security credentials associated with an SSO session.

Specified by:
updateCredentials in interface SSOClusterManager (src)
Parameters:
ssoId - the id of the SSO session
authType - the type of authenticator (BASIC, CLIENT-CERT, DIGEST or FORM) used to authenticate the SSO.
username - the username (if any) used for the authentication
password - the password (if any) used for the authentication

nodeCreated

public void nodeCreated(Fqn (src)  fqn)
Does nothing

Specified by:
nodeCreated in interface TreeCacheListener (src)
Parameters:
fqn -

nodeLoaded

public void nodeLoaded(Fqn (src)  fqn)
Does nothing

Specified by:
nodeLoaded in interface TreeCacheListener (src)

nodeVisited

public void nodeVisited(Fqn (src)  fqn)
Does nothing

Specified by:
nodeVisited in interface TreeCacheListener (src)
Parameters:
fqn -

cacheStarted

public void cacheStarted(TreeCache (src)  cache)
Does nothing

Specified by:
cacheStarted in interface TreeCacheListener (src)
Parameters:
cache -

cacheStopped

public void cacheStopped(TreeCache (src)  cache)
Does nothing

Specified by:
cacheStopped in interface TreeCacheListener (src)
Parameters:
cache -

nodeRemoved

public void nodeRemoved(Fqn (src)  fqn)
Extracts an SSO session id from the Fqn and uses it in an invocation of ClusteredSingleSignOn.deregister(String).

Ignores invocations resulting from TreeCache changes originated by this object.

Specified by:
nodeRemoved in interface TreeCacheListener (src)
Parameters:
fqn - the fully-qualified name of the node that was removed

nodeModified

public void nodeModified(Fqn (src)  fqn)
Extracts an SSO session id from the Fqn and uses it in an invocation of ClusteredSingleSignOn.update().

Only responds to modifications of nodes whose FQN's final segment is "credentials".

Ignores invocations resulting from TreeCache changes originated by this object.

Ignores invocations for SSO session id's that are not registered with the local SingleSignOn valve.

Specified by:
nodeModified in interface TreeCacheListener (src)
Parameters:
fqn - the fully-qualified name of the node that was modified

viewChange

public void viewChange(View new_view)
Does nothing

Specified by:
viewChange in interface TreeCacheListener (src)

nodeEvicted

public void nodeEvicted(Fqn (src)  fqn)
Does nothing. Called when a node is evicted (not the same as remove()).

Specified by:
nodeEvicted in interface TreeCacheListener (src)
Parameters:
fqn -

addLifecycleListener

public void addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.

Parameters:
listener - The listener to add

findLifecycleListeners

public LifecycleListener[] findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.


removeLifecycleListener

public void removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.

Parameters:
listener - The listener to remove

start

public void start()
           throws LifecycleException
Prepare for the beginning of active use of the public methods of this component. This method should be called before any of the public methods of this component are utilized. It should also send a LifecycleEvent of type START_EVENT to any registered listeners.

Throws:
LifecycleException - if this component detects a fatal error that prevents this component from being used

stop

public void stop()
          throws LifecycleException
Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component. It should also send a LifecycleEvent of type STOP_EVENT to any registered listeners.

Throws:
LifecycleException - if this component detects a fatal error that needs to be reported