public class OAuth2AuthenticationToken extends AbstractAuthenticationToken
AbstractAuthenticationToken
that represents an OAuth 2.0 Authentication.
The Authentication associates an OAuth2User Principal
to the identifier of the Authorized Client,
which the End-User (Principal) granted authorization to
so that it can access it's protected resources at the UserInfo Endpoint.
AbstractAuthenticationToken,
OAuth2User,
OAuth2AuthorizedClient,
Serialized Form| Constructor and Description |
|---|
OAuth2AuthenticationToken(OAuth2User principal,
java.util.Collection<? extends GrantedAuthority> authorities,
java.lang.String authorizedClientRegistrationId)
Constructs an
OAuth2AuthenticationToken using the provided parameters. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getAuthorizedClientRegistrationId()
Returns the registration identifier of the
Authorized Client. |
java.lang.Object |
getCredentials()
The credentials that prove the principal is correct.
|
OAuth2User |
getPrincipal()
The identity of the principal being authenticated.
|
equals, eraseCredentials, getAuthorities, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toStringpublic OAuth2AuthenticationToken(OAuth2User principal, java.util.Collection<? extends GrantedAuthority> authorities, java.lang.String authorizedClientRegistrationId)
OAuth2AuthenticationToken using the provided parameters.principal - the user Principal registered with the OAuth 2.0 Providerauthorities - the authorities granted to the userauthorizedClientRegistrationId - the registration identifier of the Authorized Clientpublic OAuth2User getPrincipal()
Authentication
The AuthenticationManager implementation will often return an
Authentication containing richer information as the principal for use by
the application. Many of the authentication providers will create a
UserDetails object as the principal.
Principal being authenticated or the authenticated
principal after authentication.public java.lang.Object getCredentials()
AuthenticationAuthenticationManager. Callers
are expected to populate the credentials.Principalpublic java.lang.String getAuthorizedClientRegistrationId()
Authorized Client.