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 org.springframework.security.core.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()
Returns the attributes about the user.
|
java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> |
getAuthorities()
Returns the authorities granted to the user.
|
java.lang.String |
getName() |
int |
hashCode() |
java.lang.String |
toString() |
public DefaultOAuth2User(java.util.Collection<? extends org.springframework.security.core.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()
getName in interface org.springframework.security.core.AuthenticatedPrincipalpublic java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities()
OAuth2UsergetAuthorities in interface OAuth2UserCollection of GrantedAuthority(s)public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
OAuth2UsergetAttributes in interface OAuth2UserMap of attributes about the userpublic 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