Class AbstractOAuth2TokenAuthenticationToken<T extends org.springframework.security.oauth2.core.OAuth2Token>

java.lang.Object
org.springframework.security.authentication.AbstractAuthenticationToken
org.springframework.security.oauth2.server.resource.authentication.AbstractOAuth2TokenAuthenticationToken<T>
All Implemented Interfaces:
Serializable, Principal, org.springframework.security.core.Authentication, org.springframework.security.core.CredentialsContainer
Direct Known Subclasses:
BearerTokenAuthentication, JwtAuthenticationToken

public abstract class AbstractOAuth2TokenAuthenticationToken<T extends org.springframework.security.oauth2.core.OAuth2Token> extends org.springframework.security.authentication.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().

Since:
5.1
See Also:
  • Constructor Details

    • AbstractOAuth2TokenAuthenticationToken

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

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

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

    • getPrincipal

      public Object getPrincipal()
    • getCredentials

      public Object getCredentials()
    • 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.
      Returns:
      a Map of the attributes in the access token.