Class SimpleAttributes2GrantedAuthoritiesMapper
java.lang.Object
org.springframework.security.core.authority.mapping.SimpleAttributes2GrantedAuthoritiesMapper
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
,Attributes2GrantedAuthoritiesMapper
public class SimpleAttributes2GrantedAuthoritiesMapper
extends Object
implements Attributes2GrantedAuthoritiesMapper, org.springframework.beans.factory.InitializingBean
This class implements the Attributes2GrantedAuthoritiesMapper interface by doing a one-to-one mapping from roles to Spring Security GrantedAuthorities. Optionally a prefix can be added, and the attribute name can be converted to upper or lower case.
By default, the attribute is prefixed with "ROLE_" unless it already starts with "ROLE_", and no case conversion is done.
- Since:
- 2.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Check whether all properties have been set to correct values.getGrantedAuthorities
(Collection<String> attributes) Map the given list of string attributes one-to-one to Spring Security GrantedAuthorities.void
setAddPrefixIfAlreadyExisting
(boolean b) void
setAttributePrefix
(String string) void
setConvertAttributeToLowerCase
(boolean b) void
setConvertAttributeToUpperCase
(boolean b)
-
Constructor Details
-
SimpleAttributes2GrantedAuthoritiesMapper
public SimpleAttributes2GrantedAuthoritiesMapper()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()Check whether all properties have been set to correct values.- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getGrantedAuthorities
Map the given list of string attributes one-to-one to Spring Security GrantedAuthorities.- Specified by:
getGrantedAuthorities
in interfaceAttributes2GrantedAuthoritiesMapper
- Parameters:
attributes
- the attributes to be mapped- Returns:
- the collection of authorities created from the attributes
-
setConvertAttributeToLowerCase
public void setConvertAttributeToLowerCase(boolean b) -
setConvertAttributeToUpperCase
public void setConvertAttributeToUpperCase(boolean b) -
setAttributePrefix
-
setAddPrefixIfAlreadyExisting
public void setAddPrefixIfAlreadyExisting(boolean b)
-