public class OAuth2AuthenticationToken extends AbstractAuthenticationToken
AbstractAuthenticationToken
that represents an OAuth 2.0 Authentication
.
It associates an OAuth2User
, ClientRegistration
and an AccessToken
.
This Authentication
is considered "authenticated" if the OAuth2User
is provided in the respective constructor. This typically happens after the OAuth2UserService
retrieves the end-user's (resource owner) attributes from the UserInfo Endpoint.
OAuth2User
,
ClientRegistration
,
AccessToken
,
Serialized FormConstructor and Description |
---|
OAuth2AuthenticationToken(ClientRegistration clientRegistration,
AccessToken accessToken) |
OAuth2AuthenticationToken(OAuth2User principal,
java.util.Collection<? extends GrantedAuthority> authorities,
ClientRegistration clientRegistration,
AccessToken accessToken) |
Modifier and Type | Method and Description |
---|---|
AccessToken |
getAccessToken() |
ClientRegistration |
getClientRegistration() |
java.lang.Object |
getCredentials()
The credentials that prove the principal is correct.
|
java.lang.Object |
getPrincipal()
The identity of the principal being authenticated.
|
equals, eraseCredentials, getAuthorities, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toString
public OAuth2AuthenticationToken(ClientRegistration clientRegistration, AccessToken accessToken)
public OAuth2AuthenticationToken(OAuth2User principal, java.util.Collection<? extends GrantedAuthority> authorities, ClientRegistration clientRegistration, AccessToken accessToken)
public java.lang.Object 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()
Authentication
AuthenticationManager
. Callers
are expected to populate the credentials.Principal
public ClientRegistration getClientRegistration()
public AccessToken getAccessToken()