public class DefaultOAuth2User extends java.lang.Object implements OAuth2User, java.io.Serializable
OAuth2User.
User attribute names are not standardized between providers
and therefore it is required to supply the key
for the user's "name" attribute to one of the constructors.
The key will be used for accessing the "name" of the
Principal (user) via getAttributes()
and returning it from getName().
OAuth2User,
Serialized Form| Constructor and Description |
|---|
DefaultOAuth2User(java.util.Collection<? extends GrantedAuthority> authorities,
java.util.Map<java.lang.String,java.lang.Object> attributes,
java.lang.String nameAttributeKey)
Constructs a
DefaultOAuth2User using the provided parameters. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
java.util.Map<java.lang.String,java.lang.Object> |
getAttributes()
Get the OAuth 2.0 token attributes
|
java.util.Collection<? extends GrantedAuthority> |
getAuthorities()
Get the
Collection of GrantedAuthoritys associated
with this OAuth 2.0 token |
java.lang.String |
getName()
Returns the name of the authenticated
Principal. |
int |
hashCode() |
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetAttributepublic DefaultOAuth2User(java.util.Collection<? extends GrantedAuthority> authorities, java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String nameAttributeKey)
DefaultOAuth2User using the provided parameters.authorities - the authorities granted to the userattributes - the attributes about the usernameAttributeKey - the key used to access the user's "name" from getAttributes()public java.lang.String getName()
AuthenticatedPrincipalPrincipal. Never null.getName in interface AuthenticatedPrincipalPrincipalpublic java.util.Collection<? extends GrantedAuthority> getAuthorities()
OAuth2AuthenticatedPrincipalCollection of GrantedAuthoritys associated
with this OAuth 2.0 tokengetAuthorities in interface OAuth2AuthenticatedPrincipalpublic java.util.Map<java.lang.String,java.lang.Object> getAttributes()
OAuth2AuthenticatedPrincipalgetAttributes in interface OAuth2AuthenticatedPrincipalpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object