Class OAuth2UserAuthority
java.lang.Object
org.springframework.security.oauth2.core.user.OAuth2UserAuthority
- All Implemented Interfaces:
Serializable,GrantedAuthority
- Direct Known Subclasses:
OidcUserAuthority
A
GrantedAuthority that may be associated to an OAuth2User.- Since:
- 5.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOAuth2UserAuthority(String authority, Map<String, Object> attributes) Constructs aOAuth2UserAuthorityusing the provided parameters.OAuth2UserAuthority(Map<String, Object> attributes) Constructs aOAuth2UserAuthorityusing the provided parameters and defaultsgetAuthority()toOAUTH2_USER. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the attributes about the user.If theGrantedAuthoritycan be represented as aStringand thatStringis sufficient in precision to be relied upon for an access control decision by anAccessDecisionManager(or delegate), this method should return such aString.inthashCode()toString()
-
Constructor Details
-
OAuth2UserAuthority
Constructs aOAuth2UserAuthorityusing the provided parameters and defaultsgetAuthority()toOAUTH2_USER.- Parameters:
attributes- the attributes about the user
-
OAuth2UserAuthority
Constructs aOAuth2UserAuthorityusing the provided parameters.- Parameters:
authority- the authority granted to the userattributes- the attributes about the user
-
-
Method Details
-
getAuthority
Description copied from interface:GrantedAuthorityIf theGrantedAuthoritycan be represented as aStringand thatStringis sufficient in precision to be relied upon for an access control decision by anAccessDecisionManager(or delegate), this method should return such aString.If the
GrantedAuthoritycannot be expressed with sufficient precision as aString,nullshould be returned. Returningnullwill require anAccessDecisionManager(or delegate) to specifically support theGrantedAuthorityimplementation, so returningnullshould be avoided unless actually required.- Specified by:
getAuthorityin interfaceGrantedAuthority- Returns:
- a representation of the granted authority (or
nullif the granted authority cannot be expressed as aStringwith sufficient precision).
-
getAttributes
Returns the attributes about the user.- Returns:
- a
Mapof attributes about the user
-
equals
-
hashCode
public int hashCode() -
toString
-