Spring Security Framework

org.springframework.security.ui.preauth.j2ee
Class AbstractPreAuthenticatedAuthenticationDetailsSource

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

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  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  String[] getUserRoles(Object context, 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.ui.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 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 String[] getUserRoles(Object context,
                                         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

Spring Security Framework

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