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 java.lang.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
Constructors Constructor Description MapBasedAttributes2GrantedAuthoritiesMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()java.util.Map<java.lang.String,java.util.Collection<GrantedAuthority>>getAttributes2grantedAuthoritiesMap()java.util.List<GrantedAuthority>getGrantedAuthorities(java.util.Collection<java.lang.String> attributes)Map the given array of attributes to Spring Security GrantedAuthorities.java.util.Set<java.lang.String>getMappableAttributes()Implementations of this method should return a set of all string attributes which can be mapped to GrantedAuthoritys.java.lang.StringgetStringSeparator()voidsetAttributes2grantedAuthoritiesMap(java.util.Map<?,?> attributes2grantedAuthoritiesMap)voidsetStringSeparator(java.lang.String stringSeparator)
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
getGrantedAuthorities
public java.util.List<GrantedAuthority> getGrantedAuthorities(java.util.Collection<java.lang.String> attributes)
Map the given array of attributes to Spring Security GrantedAuthorities.- Specified by:
getGrantedAuthoritiesin interfaceAttributes2GrantedAuthoritiesMapper- Parameters:
attributes- the attributes to be mapped- Returns:
- the collection of authorities created from the attributes
-
getAttributes2grantedAuthoritiesMap
public java.util.Map<java.lang.String,java.util.Collection<GrantedAuthority>> getAttributes2grantedAuthoritiesMap()
- Returns:
- Returns the attributes2grantedAuthoritiesMap.
-
setAttributes2grantedAuthoritiesMap
public void setAttributes2grantedAuthoritiesMap(java.util.Map<?,?> attributes2grantedAuthoritiesMap)
- Parameters:
attributes2grantedAuthoritiesMap- The attributes2grantedAuthoritiesMap to set.
-
getMappableAttributes
public java.util.Set<java.lang.String> getMappableAttributes()
Description copied from interface:MappableAttributesRetrieverImplementations of this method should return a set of all string attributes which can be mapped to GrantedAuthoritys.- Specified by:
getMappableAttributesin interfaceMappableAttributesRetriever- Returns:
- set of all mappable roles
- See Also:
MappableAttributesRetriever.getMappableAttributes()
-
getStringSeparator
public java.lang.String getStringSeparator()
- Returns:
- Returns the stringSeparator.
-
setStringSeparator
public void setStringSeparator(java.lang.String stringSeparator)
- Parameters:
stringSeparator- The stringSeparator to set.
-
-