Class ClientAuthentication

java.lang.Object
com.nimbusds.oauth2.sdk.auth.ClientAuthentication
Direct Known Subclasses:
JWTAuthentication, PlainClientSecret, TLSClientAuthentication

public abstract class ClientAuthentication extends Object
Base abstract class for client authentication at the Token endpoint.

Related specifications:

  • OAuth 2.0 (RFC 6749)
  • JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants (RFC 7523)
  • OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens (RFC 8705)
  • Constructor Details

    • ClientAuthentication

      Creates a new abstract client authentication.
      Parameters:
      method - The client authentication method. Must not be null.
      clientID - The client identifier. Must not be null.
  • Method Details

    • getMethod

      Returns the client authentication method.
      Returns:
      The client authentication method.
    • getClientID

      Returns the client identifier.
      Returns:
      The client identifier.
    • getFormParameterNames

      public abstract Set<String> getFormParameterNames()
      Returns the name of the form parameters, if such are used by the authentication method.
      Returns:
      The form parameter names, empty set if none.
    • parse

      public static ClientAuthentication parse(HTTPRequest httpRequest) throws ParseException
      Parses the specified HTTP request for a supported client authentication (see ClientAuthenticationMethod). This method is intended to aid parsing of authenticated TokenRequests.
      Parameters:
      httpRequest - The HTTP request to parse. Must not be null.
      Returns:
      The client authentication method, null if none or the method is not supported.
      Throws:
      ParseException - If the inferred client authentication couldn't be parsed.
    • applyTo

      public abstract void applyTo(HTTPRequest httpRequest)
      Applies the authentication to the specified HTTP request by setting its Authorization header and/or POST entity-body parameters (according to the implemented client authentication method).
      Parameters:
      httpRequest - The HTTP request. Must not be null.