org.springframework.security.core.authority
Class AuthorityUtils

java.lang.Object
  extended by org.springframework.security.core.authority.AuthorityUtils

public abstract class AuthorityUtils
extends java.lang.Object

Utility method for manipulating GrantedAuthority collections etc.

Mainly intended for internal use.


Field Summary
static java.util.List<GrantedAuthority> NO_AUTHORITIES
           
 
Constructor Summary
AuthorityUtils()
           
 
Method Summary
static java.util.Set<java.lang.String> authorityListToSet(java.util.Collection<GrantedAuthority> userAuthorities)
          Converts an array of GrantedAuthority objects to a Set.
static java.util.List<GrantedAuthority> commaSeparatedStringToAuthorityList(java.lang.String authorityString)
          Creates a array of GrantedAuthority objects from a comma-separated string representation (e.g.
static java.util.List<GrantedAuthority> createAuthorityList(java.lang.String... roles)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_AUTHORITIES

public static final java.util.List<GrantedAuthority> NO_AUTHORITIES
Constructor Detail

AuthorityUtils

public AuthorityUtils()
Method Detail

commaSeparatedStringToAuthorityList

public static java.util.List<GrantedAuthority> commaSeparatedStringToAuthorityList(java.lang.String authorityString)
Creates a array of GrantedAuthority objects from a comma-separated string representation (e.g. "ROLE_A, ROLE_B, ROLE_C").

Parameters:
authorityString - the comma-separated string
Returns:
the authorities created by tokenizing the string

authorityListToSet

public static java.util.Set<java.lang.String> authorityListToSet(java.util.Collection<GrantedAuthority> userAuthorities)
Converts an array of GrantedAuthority objects to a Set.

Returns:
a Set of the Strings obtained from each call to GrantedAuthority.getAuthority()

createAuthorityList

public static java.util.List<GrantedAuthority> createAuthorityList(java.lang.String... roles)