public class SimpleAttributes2GrantedAuthoritiesMapper extends Object implements Attributes2GrantedAuthoritiesMapper, 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.
Constructor and Description |
---|
SimpleAttributes2GrantedAuthoritiesMapper() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Check whether all properties have been set to correct values.
|
List<GrantedAuthority> |
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) |
public SimpleAttributes2GrantedAuthoritiesMapper()
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public List<GrantedAuthority> getGrantedAuthorities(Collection<String> attributes)
getGrantedAuthorities
in interface Attributes2GrantedAuthoritiesMapper
attributes
- the attributes to be mappedpublic void setConvertAttributeToLowerCase(boolean b)
public void setConvertAttributeToUpperCase(boolean b)
public void setAttributePrefix(String string)
public void setAddPrefixIfAlreadyExisting(boolean b)