org.jboss.web.tomcat.service.sso.jbc
Class JBossCacheSSOClusterManager

java.lang.Object
  extended by org.jboss.web.tomcat.service.sso.jbc.JBossCacheSSOClusterManager
All Implemented Interfaces:
org.jboss.web.tomcat.service.sso.spi.SSOClusterManager

public final class JBossCacheSSOClusterManager
extends Object
implements org.jboss.web.tomcat.service.sso.spi.SSOClusterManager

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

Version:
$Revision: 59567 $ $Date: 2007-01-12 03:39:24 +0100 (ven., 12 janv. 2007) $
Author:
Brian E. Stansberry

Field Summary
static String DEFAULT_CACHE_NAME
          The default JBoss Cache to use for storing SSO entries
static String DEFAULT_THREAD_POOL_NAME
          Default global value for the threadPoolName property
static String LEGACY_CACHE_NAME
          The legacy name of the JBoss Cache to use for storing SSO entries
 
Constructor Summary
JBossCacheSSOClusterManager()
          Creates a new JBossCacheSSOClusterManager
JBossCacheSSOClusterManager(MBeanServer server)
          Creates a new JBossCacheSSOClusterManager that works with the given MBeanServer.
 
Method Summary
 void addSession(String ssoId, org.jboss.web.tomcat.service.sso.spi.FullyQualifiedSessionId sessionId)
          Notify the cluster of the addition of a Session to an SSO session.
 String getCacheName()
           
 int getSessionCount(String ssoId)
          Gets the number of sessions associated with the given SSO.
 org.jboss.web.tomcat.service.sso.spi.SSOLocalManager getSSOLocalManager()
          Gets the SingleSignOn valve for which this object is handling cluster communications.
 String getThreadPoolName()
           
 boolean isUsingThreadPool()
           
 void logout(String ssoId)
          Notifies the cluster that a single sign on session has been terminated due to a user logout.
 org.jboss.web.tomcat.service.sso.spi.SSOCredentials lookup(String ssoId)
           
 void nodeModified(org.jboss.cache.notifications.event.NodeModifiedEvent event)
          Extracts an SSO session id from the Fqn and uses it in an invocation of ClusteredSingleSignOn.update().
 void nodeRemoved(org.jboss.cache.notifications.event.NodeRemovedEvent event)
          Extracts an SSO session id from the Fqn and uses it in an invocation of ClusteredSingleSignOn.deregister(String).
 void register(String ssoId, String authType, String username, String password)
          Notifies the cluster of the creation of a new SSO entry.
 void removeSession(String ssoId, org.jboss.web.tomcat.service.sso.spi.FullyQualifiedSessionId sessionId)
          Notify the cluster of the removal of a Session from an SSO session.
 void setSSOLocalManager(org.jboss.web.tomcat.service.sso.spi.SSOLocalManager localManager)
          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(String ssoId, String authType, String username, String password)
          Notifies the cluster of an update of the security credentials associated with an SSO session.
 void viewChange(org.jboss.cache.notifications.event.ViewChangedEvent event)
          If any nodes have been removed from the view, asynchronously scans all SSOs looking for and removing sessions owned by the removed node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_THREAD_POOL_NAME

public static final String DEFAULT_THREAD_POOL_NAME
Default global value for the threadPoolName property

See Also:
Constant Field Values

DEFAULT_CACHE_NAME

public static final String DEFAULT_CACHE_NAME
The default JBoss Cache to use for storing SSO entries

See Also:
Constant Field Values

LEGACY_CACHE_NAME

public static final String LEGACY_CACHE_NAME
The legacy name of the JBoss Cache to use for storing SSO entries

See Also:
Constant Field Values
Constructor Detail

JBossCacheSSOClusterManager

public JBossCacheSSOClusterManager()
Creates a new JBossCacheSSOClusterManager


JBossCacheSSOClusterManager

public JBossCacheSSOClusterManager(MBeanServer server)
Creates a new JBossCacheSSOClusterManager that works with the given MBeanServer. This constructor is only intended for use in unit testing.

Method Detail

getCacheName

public String getCacheName()

getThreadPoolName

public String getThreadPoolName()

isUsingThreadPool

public boolean isUsingThreadPool()

addSession

public void addSession(String ssoId,
                       org.jboss.web.tomcat.service.sso.spi.FullyQualifiedSessionId sessionId)
Notify the cluster of the addition of a Session to an SSO session.

Specified by:
addSession in interface org.jboss.web.tomcat.service.sso.spi.SSOClusterManager
Parameters:
ssoId - the id of the SSO session
sessionId - id of the Session that has been added

getSSOLocalManager

public org.jboss.web.tomcat.service.sso.spi.SSOLocalManager getSSOLocalManager()
Gets the SingleSignOn valve for which this object is handling cluster communications.

Specified by:
getSSOLocalManager in interface org.jboss.web.tomcat.service.sso.spi.SSOClusterManager
Returns:
the SingleSignOn valve.

setSSOLocalManager

public void setSSOLocalManager(org.jboss.web.tomcat.service.sso.spi.SSOLocalManager localManager)
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:
setSSOLocalManager in interface org.jboss.web.tomcat.service.sso.spi.SSOClusterManager
Parameters:
localManager - a SingleSignOn valve.

logout

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

Specified by:
logout in interface org.jboss.web.tomcat.service.sso.spi.SSOClusterManager
Parameters:
ssoId -

lookup

public org.jboss.web.tomcat.service.sso.spi.SSOCredentials lookup(String ssoId)
Specified by:
lookup in interface org.jboss.web.tomcat.service.sso.spi.SSOClusterManager

register

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

Specified by:
register in interface org.jboss.web.tomcat.service.sso.spi.SSOClusterManager
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(String ssoId,
                          org.jboss.web.tomcat.service.sso.spi.FullyQualifiedSessionId sessionId)
Notify the cluster of the removal of a Session from an SSO session.

Specified by:
removeSession in interface org.jboss.web.tomcat.service.sso.spi.SSOClusterManager
Parameters:
ssoId - the id of the SSO session
sessionId - id of the Session that has been removed

updateCredentials

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

Specified by:
updateCredentials in interface org.jboss.web.tomcat.service.sso.spi.SSOClusterManager
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

nodeRemoved

public void nodeRemoved(org.jboss.cache.notifications.event.NodeRemovedEvent event)
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.

Parameters:
fqn - the fully-qualified name of the node that was removed

viewChange

public void viewChange(org.jboss.cache.notifications.event.ViewChangedEvent event)
If any nodes have been removed from the view, asynchronously scans all SSOs looking for and removing sessions owned by the removed node. Notifies the SSO valve if as a result any SSOs no longer have active sessions. If the removed node is the one associated with this object, does nothing.


nodeModified

public void nodeModified(org.jboss.cache.notifications.event.NodeModifiedEvent event)
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.

Parameters:
fqn - the fully-qualified name of the node that was modified

start

public void start()
           throws Exception
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.

Specified by:
start in interface org.jboss.web.tomcat.service.sso.spi.SSOClusterManager
Throws:
LifecycleException - if this component detects a fatal error that prevents this component from being used
Exception

stop

public void stop()
          throws Exception
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.

Specified by:
stop in interface org.jboss.web.tomcat.service.sso.spi.SSOClusterManager
Throws:
LifecycleException - if this component detects a fatal error that needs to be reported
Exception

getSessionCount

public int getSessionCount(String ssoId)
                    throws Exception
Gets the number of sessions associated with the given SSO. The same session active on more than one node will count twice.

Throws:
Exception


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.