org.springframework.flex.security
Class SpringSecurityLoginCommand

java.lang.Object
  extended by org.springframework.flex.security.SpringSecurityLoginCommand
All Implemented Interfaces:
flex.messaging.security.LoginCommand, MessageBrokerConfigProcessor

public class SpringSecurityLoginCommand
extends java.lang.Object
implements flex.messaging.security.LoginCommand, MessageBrokerConfigProcessor

Custom BlazeDS LoginCommand that uses Spring Security for Authentication and Authorization.

Should be configured as a Spring bean and given a reference to the current AuthenticationManager. It must be added to the MessageBrokerFactoryBean's list of MessageBrokerConfigProcessors.

Will be configured automatically when using the secured tag in the xml config namespace.

Author:
Jeremy Grelle
See Also:
MessageBrokerFactoryBean

Constructor Summary
SpringSecurityLoginCommand(org.springframework.security.AuthenticationManager authManager)
          Creates a new SpringSecurityLoginCommand with the provided AuthenticationManager
 
Method Summary
 java.security.Principal doAuthentication(java.lang.String username, java.lang.Object credentials)
          
 boolean doAuthorization(java.security.Principal principal, java.util.List roles)
          
protected  java.lang.String extractPassword(java.lang.Object credentials)
          Extracts the password from the Flex client credentials
 org.springframework.security.AuthenticationManager getAuthManager()
          Returns the Spring Security AuthenticationManager
 boolean isPerClientAuthentication()
          Checks whether per-client authentication is enabled
 boolean logout(java.security.Principal principal)
          
 flex.messaging.MessageBroker processAfterStartup(flex.messaging.MessageBroker broker)
          Apply this config processor to the newly created MessageBroker after it and all of its services have been started but before it is available for use.
 flex.messaging.MessageBroker processBeforeStartup(flex.messaging.MessageBroker broker)
          Apply this config processor to the newly created MessageBroker after its intial configuration settings have been parsed from the BlazeDS XML configuration, but before it has actually been started.
 void setPerClientAuthentication(boolean perClientAuthentication)
          Configures the per-client authentication setting for the BlazeDS login manager
 void start(javax.servlet.ServletConfig config)
          
 void stop()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringSecurityLoginCommand

public SpringSecurityLoginCommand(org.springframework.security.AuthenticationManager authManager)
Creates a new SpringSecurityLoginCommand with the provided AuthenticationManager

Parameters:
authManager - the authentication manager
Method Detail

doAuthentication

public java.security.Principal doAuthentication(java.lang.String username,
                                                java.lang.Object credentials)

Specified by:
doAuthentication in interface flex.messaging.security.LoginCommand

doAuthorization

public boolean doAuthorization(java.security.Principal principal,
                               java.util.List roles)

Specified by:
doAuthorization in interface flex.messaging.security.LoginCommand

getAuthManager

public org.springframework.security.AuthenticationManager getAuthManager()
Returns the Spring Security AuthenticationManager

Returns:
the authentication manager

isPerClientAuthentication

public boolean isPerClientAuthentication()
Checks whether per-client authentication is enabled

Returns:
true is per-client authentication is enabled

logout

public boolean logout(java.security.Principal principal)

Specified by:
logout in interface flex.messaging.security.LoginCommand

processAfterStartup

public flex.messaging.MessageBroker processAfterStartup(flex.messaging.MessageBroker broker)
Apply this config processor to the newly created MessageBroker after it and all of its services have been started but before it is available for use.

Specified by:
processAfterStartup in interface MessageBrokerConfigProcessor
Parameters:
broker - the started MessageBroker instance
Returns:
the modified MessageBroker

processBeforeStartup

public flex.messaging.MessageBroker processBeforeStartup(flex.messaging.MessageBroker broker)
Apply this config processor to the newly created MessageBroker after its intial configuration settings have been parsed from the BlazeDS XML configuration, but before it has actually been started.

Specified by:
processBeforeStartup in interface MessageBrokerConfigProcessor
Parameters:
broker - the new MessageBroker instance
Returns:
the modified MessageBroker

setPerClientAuthentication

public void setPerClientAuthentication(boolean perClientAuthentication)
Configures the per-client authentication setting for the BlazeDS login manager

Parameters:
perClientAuthentication - true if per-client authentication is enabled

start

public void start(javax.servlet.ServletConfig config)

Specified by:
start in interface flex.messaging.security.LoginCommand

stop

public void stop()

Specified by:
stop in interface flex.messaging.security.LoginCommand

extractPassword

protected java.lang.String extractPassword(java.lang.Object credentials)
Extracts the password from the Flex client credentials

Parameters:
credentials - the Flex client credentials
Returns:
the extracted password