Class MapBasedAttributes2GrantedAuthoritiesMapper
java.lang.Object
org.springframework.security.core.authority.mapping.MapBasedAttributes2GrantedAuthoritiesMapper
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
,Attributes2GrantedAuthoritiesMapper
,MappableAttributesRetriever
public class MapBasedAttributes2GrantedAuthoritiesMapper
extends Object
implements Attributes2GrantedAuthoritiesMapper, MappableAttributesRetriever, org.springframework.beans.factory.InitializingBean
This class implements the Attributes2GrantedAuthoritiesMapper and
MappableAttributesRetriever interfaces based on the supplied Map. It supports both
one-to-one and one-to-many mappings. The granted authorities to map to can be supplied
either as a String or as a GrantedAuthority object.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
getGrantedAuthorities
(Collection<String> attributes) Map the given array of attributes to Spring Security GrantedAuthorities.Implementations of this method should return a set of all string attributes which can be mapped to GrantedAuthoritys.void
setAttributes2grantedAuthoritiesMap
(Map<?, ?> attributes2grantedAuthoritiesMap) void
setStringSeparator
(String stringSeparator)
-
Constructor Details
-
MapBasedAttributes2GrantedAuthoritiesMapper
public MapBasedAttributes2GrantedAuthoritiesMapper()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getGrantedAuthorities
Map the given array of attributes 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
-
getAttributes2grantedAuthoritiesMap
- Returns:
- Returns the attributes2grantedAuthoritiesMap.
-
setAttributes2grantedAuthoritiesMap
- Parameters:
attributes2grantedAuthoritiesMap
- The attributes2grantedAuthoritiesMap to set.
-
getMappableAttributes
Description copied from interface:MappableAttributesRetriever
Implementations of this method should return a set of all string attributes which can be mapped to GrantedAuthoritys.- Specified by:
getMappableAttributes
in interfaceMappableAttributesRetriever
- Returns:
- set of all mappable roles
- See Also:
-
getStringSeparator
- Returns:
- Returns the stringSeparator.
-
setStringSeparator
- Parameters:
stringSeparator
- The stringSeparator to set.
-