Spring BlazeDS Integration

org.springframework.flex.security3
Class SpringSecurityLoginCommand

java.lang.Object
  extended by org.springframework.flex.security3.SpringSecurityLoginCommand
All Implemented Interfaces:
LoginCommand, InitializingBean

public class SpringSecurityLoginCommand
extends Object
implements LoginCommand, InitializingBean

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

Field Summary
protected  AuthenticationDetailsSource authenticationDetailsSource
           
 
Constructor Summary
SpringSecurityLoginCommand(AuthenticationManager authManager)
          Creates a new SpringSecurityLoginCommand with the provided AuthenticationManager
 
Method Summary
 void afterPropertiesSet()
           
 Principal doAuthentication(String username, Object credentials)
          
 boolean doAuthorization(Principal principal, List roles)
          
protected  String extractPassword(Object credentials)
          Extracts the password from the Flex client credentials
 AuthenticationManager getAuthManager()
          Returns the Spring Security AuthenticationManager
 boolean isPerClientAuthentication()
          Checks whether per-client authentication is enabled
 boolean logout(Principal principal)
          
protected  void setDetails(javax.servlet.http.HttpServletRequest request, UsernamePasswordAuthenticationToken authRequest)
          Provided so that subclasses may configure what is put into the authentication request's details property.
 void setLogoutHandlers(List<LogoutHandler> logoutHandlers)
           
 void setPerClientAuthentication(boolean perClientAuthentication)
           
 void setRememberMeServices(RememberMeServices rememberMeServices)
           
 void setSessionAuthenticationStrategy(SessionAuthenticationStrategy sessionStrategy)
           
 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
 

Field Detail

authenticationDetailsSource

protected AuthenticationDetailsSource authenticationDetailsSource
Constructor Detail

SpringSecurityLoginCommand

public SpringSecurityLoginCommand(AuthenticationManager authManager)
Creates a new SpringSecurityLoginCommand with the provided AuthenticationManager

Parameters:
authManager - the authentication manager
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

doAuthentication

public Principal doAuthentication(String username,
                                  Object credentials)

Specified by:
doAuthentication in interface LoginCommand

doAuthorization

public boolean doAuthorization(Principal principal,
                               List roles)

Specified by:
doAuthorization in interface LoginCommand

getAuthManager

public 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(Principal principal)

Specified by:
logout in interface LoginCommand

setLogoutHandlers

public void setLogoutHandlers(List<LogoutHandler> logoutHandlers)

setPerClientAuthentication

public void setPerClientAuthentication(boolean perClientAuthentication)

setRememberMeServices

public void setRememberMeServices(RememberMeServices rememberMeServices)

setSessionAuthenticationStrategy

public void setSessionAuthenticationStrategy(SessionAuthenticationStrategy sessionStrategy)

start

public void start(javax.servlet.ServletConfig config)

Specified by:
start in interface LoginCommand

stop

public void stop()

Specified by:
stop in interface LoginCommand

extractPassword

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

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

setDetails

protected void setDetails(javax.servlet.http.HttpServletRequest request,
                          UsernamePasswordAuthenticationToken authRequest)
Provided so that subclasses may configure what is put into the authentication request's details property.

Parameters:
request - that an authentication request is being created for
authRequest - the authentication request object that should have its details set

Spring BlazeDS Integration

Copyright © 2011. All Rights Reserved.