public final class SimpleAuthorityMapper extends java.lang.Object implements GrantedAuthoritiesMapper, org.springframework.beans.factory.InitializingBean
GrantedAuthoritiesMapper which allows for case conversion of
the authority name and the addition of a string prefix (which defaults to ROLE_
).| Constructor and Description |
|---|
SimpleAuthorityMapper() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
java.util.Set<GrantedAuthority> |
mapAuthorities(java.util.Collection<? extends GrantedAuthority> authorities)
Creates a mapping of the supplied authorities based on the case-conversion and
prefix settings.
|
void |
setConvertToLowerCase(boolean convertToLowerCase)
Whether to convert the authority value to lower case in the mapping.
|
void |
setConvertToUpperCase(boolean convertToUpperCase)
Whether to convert the authority value to upper case in the mapping.
|
void |
setDefaultAuthority(java.lang.String authority)
Sets a default authority to be assigned to all users
|
void |
setPrefix(java.lang.String prefix)
Sets the prefix which should be added to the authority name (if it doesn't already
exist)
|
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionpublic java.util.Set<GrantedAuthority> mapAuthorities(java.util.Collection<? extends GrantedAuthority> authorities)
mapAuthorities in interface GrantedAuthoritiesMapperauthorities - the original authoritiespublic void setPrefix(java.lang.String prefix)
prefix - the prefix, typically to satisfy the behaviour of an
AccessDecisionVoter.public void setConvertToUpperCase(boolean convertToUpperCase)
convertToUpperCase - defaults to falsepublic void setConvertToLowerCase(boolean convertToLowerCase)
convertToLowerCase - defaults to falsepublic void setDefaultAuthority(java.lang.String authority)
authority - the name of the authority to be assigned to all users.