public abstract class

AuthorityUtils

extends Object
java.lang.Object
   ↳ org.springframework.security.core.authority.AuthorityUtils

Class Overview

Utility method for manipulating GrantedAuthority collections etc.

Mainly intended for internal use.

Summary

Fields
public static final List<GrantedAuthority> NO_AUTHORITIES
Public Constructors
AuthorityUtils()
Public Methods
static Set<String> authorityListToSet(Collection<? extends GrantedAuthority> userAuthorities)
Converts an array of GrantedAuthority objects to a Set.
static List<GrantedAuthority> commaSeparatedStringToAuthorityList(String authorityString)
Creates a array of GrantedAuthority objects from a comma-separated string representation (e.g.
static List<GrantedAuthority> createAuthorityList(String... roles)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static final List<GrantedAuthority> NO_AUTHORITIES

Public Constructors

public AuthorityUtils ()

Public Methods

public static Set<String> authorityListToSet (Collection<? extends GrantedAuthority> userAuthorities)

Converts an array of GrantedAuthority objects to a Set.

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

public static List<GrantedAuthority> commaSeparatedStringToAuthorityList (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

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