org.springframework.security.web.authentication.preauth.j2ee
Class AbstractPreAuthenticatedAuthenticationDetailsSource

java.lang.Object
  extended by org.springframework.security.authentication.AuthenticationDetailsSourceImpl
      extended by org.springframework.security.web.authentication.preauth.j2ee.AbstractPreAuthenticatedAuthenticationDetailsSource
All Implemented Interfaces:
AuthenticationDetailsSource
Direct Known Subclasses:
J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource

public abstract class AbstractPreAuthenticatedAuthenticationDetailsSource
extends AuthenticationDetailsSourceImpl

Base implementation for classes scenarios where the authentication details object is used to store a list of authorities obtained from the context object (such as an HttpServletRequest) passed to buildDetails(Object).

Since:
2.0
Author:
Luke Taylor

Field Summary
protected  Set<String> j2eeMappableRoles
           
protected  Attributes2GrantedAuthoritiesMapper j2eeUserRoles2GrantedAuthoritiesMapper
           
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
AbstractPreAuthenticatedAuthenticationDetailsSource()
           
 
Method Summary
 void afterPropertiesSet()
          Check that all required properties have been set.
 Object buildDetails(Object context)
          Build the authentication details object.
protected abstract  Collection<String> getUserRoles(Object context, Set<String> mappableRoles)
          Allows the roles of the current user to be determined from the context object
 void setMappableRolesRetriever(MappableAttributesRetriever aJ2eeMappableRolesRetriever)
           
 void setUserRoles2GrantedAuthoritiesMapper(Attributes2GrantedAuthoritiesMapper mapper)
           
 
Methods inherited from class org.springframework.security.authentication.AuthenticationDetailsSourceImpl
setClazz
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger

j2eeMappableRoles

protected Set<String> j2eeMappableRoles

j2eeUserRoles2GrantedAuthoritiesMapper

protected Attributes2GrantedAuthoritiesMapper j2eeUserRoles2GrantedAuthoritiesMapper
Constructor Detail

AbstractPreAuthenticatedAuthenticationDetailsSource

public AbstractPreAuthenticatedAuthenticationDetailsSource()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Check that all required properties have been set.

Throws:
Exception

buildDetails

public Object buildDetails(Object context)
Build the authentication details object. If the specified authentication details class implements MutableGrantedAuthoritiesContainer, a list of pre-authenticated Granted Authorities will be set based on the roles for the current user.

Specified by:
buildDetails in interface AuthenticationDetailsSource
Overrides:
buildDetails in class AuthenticationDetailsSourceImpl
Parameters:
context - the request object, which may be used by the authentication details object
Returns:
a fully-configured authentication details instance
See Also:
AuthenticationDetailsSource.buildDetails(Object)

getUserRoles

protected abstract Collection<String> getUserRoles(Object context,
                                                   Set<String> mappableRoles)
Allows the roles of the current user to be determined from the context object

Parameters:
context - the context object (an HttpRequest, PortletRequest etc)
mappableRoles - the possible roles as determined by the MappableAttributesRetriever
Returns:
the subset of mappable roles which the current user has.

setMappableRolesRetriever

public void setMappableRolesRetriever(MappableAttributesRetriever aJ2eeMappableRolesRetriever)
Parameters:
aJ2eeMappableRolesRetriever - The MappableAttributesRetriever to use

setUserRoles2GrantedAuthoritiesMapper

public void setUserRoles2GrantedAuthoritiesMapper(Attributes2GrantedAuthoritiesMapper mapper)
Parameters:
mapper - The Attributes2GrantedAuthoritiesMapper to use


Copyright © 2004-2009 SpringSource, Inc. All Rights Reserved.