public abstract class AuthorityUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static GrantedAuthority[] |
NO_AUTHORITIES |
Constructor and Description |
---|
AuthorityUtils() |
Modifier and Type | Method and Description |
---|---|
static java.util.Set |
authorityArrayToSet(GrantedAuthority[] authorities)
Converts an array of GrantedAuthority objects to a Set.
|
static GrantedAuthority[] |
commaSeparatedStringToAuthorityArray(java.lang.String authorityString)
Creates a array of GrantedAuthority objects from a comma-separated string
representation (e.g.
|
static GrantedAuthority[] |
stringArrayToAuthorityArray(java.lang.String[] roles) |
static boolean |
userHasAuthority(java.lang.String authority)
Returns true if the current user has the specified authority.
|
public static final GrantedAuthority[] NO_AUTHORITIES
public static boolean userHasAuthority(java.lang.String authority)
authority
- the authority to test for (e.g. "ROLE_A").public static GrantedAuthority[] commaSeparatedStringToAuthorityArray(java.lang.String authorityString)
authorityString
- the comma-separated stringpublic static java.util.Set authorityArrayToSet(GrantedAuthority[] authorities)
public static GrantedAuthority[] stringArrayToAuthorityArray(java.lang.String[] roles)