Class OAuth2ClientAuthenticationToken

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

@Transient public class OAuth2ClientAuthenticationToken extends org.springframework.security.authentication.AbstractAuthenticationToken
An Authentication implementation used for OAuth 2.0 Client Authentication.
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
    OAuth2ClientAuthenticationToken(String clientId, org.springframework.security.oauth2.core.ClientAuthenticationMethod clientAuthenticationMethod, Object credentials, Map<String,Object> additionalParameters)
    Constructs an OAuth2ClientAuthenticationToken using the provided parameters.
    OAuth2ClientAuthenticationToken(RegisteredClient registeredClient, org.springframework.security.oauth2.core.ClientAuthenticationMethod clientAuthenticationMethod, Object credentials)
    Constructs an OAuth2ClientAuthenticationToken using the provided parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the additional parameters.
    org.springframework.security.oauth2.core.ClientAuthenticationMethod
    Returns the authentication method used by the client.
     
     
    Returns the authenticated registered client, or null if not authenticated.

    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

    • OAuth2ClientAuthenticationToken

      public OAuth2ClientAuthenticationToken(String clientId, org.springframework.security.oauth2.core.ClientAuthenticationMethod clientAuthenticationMethod, @Nullable Object credentials, @Nullable Map<String,Object> additionalParameters)
      Constructs an OAuth2ClientAuthenticationToken using the provided parameters.
      Parameters:
      clientId - the client identifier
      clientAuthenticationMethod - the authentication method used by the client
      credentials - the client credentials
      additionalParameters - the additional parameters
    • OAuth2ClientAuthenticationToken

      public OAuth2ClientAuthenticationToken(RegisteredClient registeredClient, org.springframework.security.oauth2.core.ClientAuthenticationMethod clientAuthenticationMethod, @Nullable Object credentials)
      Constructs an OAuth2ClientAuthenticationToken using the provided parameters.
      Parameters:
      registeredClient - the authenticated registered client
      clientAuthenticationMethod - the authentication method used by the client
      credentials - the client credentials
  • Method Details

    • getPrincipal

      public Object getPrincipal()
    • getCredentials

      @Nullable public Object getCredentials()
    • getRegisteredClient

      @Nullable public RegisteredClient getRegisteredClient()
      Returns the authenticated registered client, or null if not authenticated.
      Returns:
      the authenticated RegisteredClient, or null if not authenticated
    • getClientAuthenticationMethod

      public org.springframework.security.oauth2.core.ClientAuthenticationMethod getClientAuthenticationMethod()
      Returns the authentication method used by the client.
      Returns:
      the ClientAuthenticationMethod used by the client
    • getAdditionalParameters

      public Map<String,Object> getAdditionalParameters()
      Returns the additional parameters.
      Returns:
      the additional parameters