Class J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource
- java.lang.Object
-
- org.springframework.security.web.authentication.preauth.j2ee.J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource
-
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean,org.springframework.security.authentication.AuthenticationDetailsSource<javax.servlet.http.HttpServletRequest,PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails>
public class J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource extends java.lang.Object implements org.springframework.security.authentication.AuthenticationDetailsSource<javax.servlet.http.HttpServletRequest,PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails>, org.springframework.beans.factory.InitializingBean
Implementation of AuthenticationDetailsSource which converts the user's J2EE roles (as obtained by callingHttpServletRequest.isUserInRole(String)) intoGrantedAuthoritys and stores these in the authentication details object.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<java.lang.String>j2eeMappableRolesThe role attributes returned by the configuredMappableAttributesRetrieverprotected org.springframework.security.core.authority.mapping.Attributes2GrantedAuthoritiesMapperj2eeUserRoles2GrantedAuthoritiesMapperprotected org.apache.commons.logging.Loglogger
-
Constructor Summary
Constructors Constructor Description J2eeBasedPreAuthenticatedWebAuthenticationDetailsSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()Check that all required properties have been set.PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetailsbuildDetails(javax.servlet.http.HttpServletRequest context)Builds the authentication details object.protected java.util.Collection<java.lang.String>getUserRoles(javax.servlet.http.HttpServletRequest request)Obtains the list of user roles based on the current user's JEE roles.voidsetMappableRolesRetriever(org.springframework.security.core.authority.mapping.MappableAttributesRetriever aJ2eeMappableRolesRetriever)voidsetUserRoles2GrantedAuthoritiesMapper(org.springframework.security.core.authority.mapping.Attributes2GrantedAuthoritiesMapper mapper)
-
-
-
Field Detail
-
logger
protected final org.apache.commons.logging.Log logger
-
j2eeMappableRoles
protected java.util.Set<java.lang.String> j2eeMappableRoles
The role attributes returned by the configuredMappableAttributesRetriever
-
j2eeUserRoles2GrantedAuthoritiesMapper
protected org.springframework.security.core.authority.mapping.Attributes2GrantedAuthoritiesMapper j2eeUserRoles2GrantedAuthoritiesMapper
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
Check that all required properties have been set.- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
getUserRoles
protected java.util.Collection<java.lang.String> getUserRoles(javax.servlet.http.HttpServletRequest request)
Obtains the list of user roles based on the current user's JEE roles. TheHttpServletRequest.isUserInRole(String)method is called for each of the values in thej2eeMappableRolesset to determine if that role should be assigned to the user.- Parameters:
request- the request which should be used to extract the user's roles.- Returns:
- The subset of
j2eeMappableRoleswhich applies to the current user making the request.
-
buildDetails
public PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails buildDetails(javax.servlet.http.HttpServletRequest context)
Builds the authentication details object.- Specified by:
buildDetailsin interfaceorg.springframework.security.authentication.AuthenticationDetailsSource<javax.servlet.http.HttpServletRequest,PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails>- See Also:
AuthenticationDetailsSource.buildDetails(Object)
-
setMappableRolesRetriever
public void setMappableRolesRetriever(org.springframework.security.core.authority.mapping.MappableAttributesRetriever aJ2eeMappableRolesRetriever)
- Parameters:
aJ2eeMappableRolesRetriever- The MappableAttributesRetriever to use
-
setUserRoles2GrantedAuthoritiesMapper
public void setUserRoles2GrantedAuthoritiesMapper(org.springframework.security.core.authority.mapping.Attributes2GrantedAuthoritiesMapper mapper)
- Parameters:
mapper- The Attributes2GrantedAuthoritiesMapper to use
-
-