Class OAuth2AccessTokenAuthenticationToken

java.lang.Object
org.springframework.security.authentication.AbstractAuthenticationToken
org.springframework.security.oauth2.server.authorization.authentication.OAuth2AccessTokenAuthenticationToken
All Implemented Interfaces:
Serializable, Principal, org.springframework.security.core.Authentication, org.springframework.security.core.CredentialsContainer

public class OAuth2AccessTokenAuthenticationToken extends org.springframework.security.authentication.AbstractAuthenticationToken
An Authentication implementation used when issuing an OAuth 2.0 Access Token and (optional) Refresh Token.
Since:
7.0
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.security.authentication.AbstractAuthenticationToken

    org.springframework.security.authentication.AbstractAuthenticationToken.AbstractAuthenticationBuilder<B extends org.springframework.security.authentication.AbstractAuthenticationToken.AbstractAuthenticationBuilder<B>>

    Nested classes/interfaces inherited from interface org.springframework.security.core.Authentication

    org.springframework.security.core.Authentication.Builder<B extends org.springframework.security.core.Authentication.Builder<B>>
  • Constructor Summary

    Constructors
    Constructor
    Description
    OAuth2AccessTokenAuthenticationToken(RegisteredClient registeredClient, org.springframework.security.core.Authentication clientPrincipal, org.springframework.security.oauth2.core.OAuth2AccessToken accessToken)
    Constructs an OAuth2AccessTokenAuthenticationToken using the provided parameters.
    OAuth2AccessTokenAuthenticationToken(RegisteredClient registeredClient, org.springframework.security.core.Authentication clientPrincipal, org.springframework.security.oauth2.core.OAuth2AccessToken accessToken, org.springframework.security.oauth2.core.OAuth2RefreshToken refreshToken)
    Constructs an OAuth2AccessTokenAuthenticationToken using the provided parameters.
    OAuth2AccessTokenAuthenticationToken(RegisteredClient registeredClient, org.springframework.security.core.Authentication clientPrincipal, org.springframework.security.oauth2.core.OAuth2AccessToken accessToken, org.springframework.security.oauth2.core.OAuth2RefreshToken refreshToken, Map<String,Object> additionalParameters)
    Constructs an OAuth2AccessTokenAuthenticationToken using the provided parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.oauth2.core.OAuth2AccessToken
    Returns the access token.
    Returns the additional parameters.
     
     
    org.springframework.security.oauth2.core.OAuth2RefreshToken
    Returns the refresh token.
    Returns the registered client.

    Methods inherited from class org.springframework.security.authentication.AbstractAuthenticationToken

    equals, eraseCredentials, getAuthorities, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.springframework.security.core.Authentication

    toBuilder

    Methods inherited from interface java.security.Principal

    implies
  • Constructor Details

    • OAuth2AccessTokenAuthenticationToken

      public OAuth2AccessTokenAuthenticationToken(RegisteredClient registeredClient, org.springframework.security.core.Authentication clientPrincipal, org.springframework.security.oauth2.core.OAuth2AccessToken accessToken)
      Constructs an OAuth2AccessTokenAuthenticationToken using the provided parameters.
      Parameters:
      registeredClient - the registered client
      clientPrincipal - the authenticated client principal
      accessToken - the access token
    • OAuth2AccessTokenAuthenticationToken

      public OAuth2AccessTokenAuthenticationToken(RegisteredClient registeredClient, org.springframework.security.core.Authentication clientPrincipal, org.springframework.security.oauth2.core.OAuth2AccessToken accessToken, @Nullable org.springframework.security.oauth2.core.OAuth2RefreshToken refreshToken)
      Constructs an OAuth2AccessTokenAuthenticationToken using the provided parameters.
      Parameters:
      registeredClient - the registered client
      clientPrincipal - the authenticated client principal
      accessToken - the access token
      refreshToken - the refresh token
    • OAuth2AccessTokenAuthenticationToken

      public OAuth2AccessTokenAuthenticationToken(RegisteredClient registeredClient, org.springframework.security.core.Authentication clientPrincipal, org.springframework.security.oauth2.core.OAuth2AccessToken accessToken, @Nullable org.springframework.security.oauth2.core.OAuth2RefreshToken refreshToken, Map<String,Object> additionalParameters)
      Constructs an OAuth2AccessTokenAuthenticationToken using the provided parameters.
      Parameters:
      registeredClient - the registered client
      clientPrincipal - the authenticated client principal
      accessToken - the access token
      refreshToken - the refresh token
      additionalParameters - the additional parameters
  • Method Details

    • getPrincipal

      public Object getPrincipal()
    • getCredentials

      public Object getCredentials()
    • getRegisteredClient

      public RegisteredClient getRegisteredClient()
      Returns the registered client.
      Returns:
      the RegisteredClient
    • getAccessToken

      public org.springframework.security.oauth2.core.OAuth2AccessToken getAccessToken()
      Returns the access token.
      Returns:
      the OAuth2AccessToken
    • getRefreshToken

      @Nullable public org.springframework.security.oauth2.core.OAuth2RefreshToken getRefreshToken()
      Returns the refresh token.
      Returns:
      the OAuth2RefreshToken or null if not available
    • getAdditionalParameters

      public Map<String,Object> getAdditionalParameters()
      Returns the additional parameters.
      Returns:
      a Map of the additional parameters, may be empty