Class AbstractOAuth2TokenAuthenticationToken<T extends OAuth2Token>

All Implemented Interfaces:
Serializable, Principal, Authentication, CredentialsContainer
Direct Known Subclasses:
BearerTokenAuthentication, JwtAuthenticationToken

public abstract class AbstractOAuth2TokenAuthenticationToken<T extends OAuth2Token> extends AbstractAuthenticationToken
Base class for AbstractAuthenticationToken implementations that expose common attributes between different OAuth 2.0 Access Token Formats.

For example, a Jwt could expose its claims via getTokenAttributes() or an "Introspected" OAuth 2.0 Access Token could expose the attributes of the Introspection Response via getTokenAttributes().

See Also:
  • Constructor Details

    • AbstractOAuth2TokenAuthenticationToken

      protected AbstractOAuth2TokenAuthenticationToken(T token)
      Sub-class constructor.
    • AbstractOAuth2TokenAuthenticationToken

      protected AbstractOAuth2TokenAuthenticationToken(T token, Collection<? extends GrantedAuthority> authorities)
      Sub-class constructor.
      authorities - the authorities assigned to the Access Token
    • AbstractOAuth2TokenAuthenticationToken

      protected AbstractOAuth2TokenAuthenticationToken(T token, Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities)
  • Method Details

    • getPrincipal

      public Object getPrincipal()
      Description copied from interface: Authentication
      The identity of the principal being authenticated. In the case of an authentication request with username and password, this would be the username. Callers are expected to populate the principal for an authentication request.

      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.

      the Principal being authenticated or the authenticated principal after authentication.
    • getCredentials

      public Object getCredentials()
      Description copied from interface: Authentication
      The credentials that prove the principal is correct. This is usually a password, but could be anything relevant to the AuthenticationManager. Callers are expected to populate the credentials.
      the credentials that prove the identity of the Principal
    • getToken

      public final T getToken()
      Get the token bound to this Authentication.
    • getTokenAttributes

      public abstract Map<String,Object> getTokenAttributes()
      Returns the attributes of the access token.
      a Map of the attributes in the access token.