Client authentication methods

In the context of OAuth 2.0 confidential clients have to authenticate with the authorization server when making requests to the token endpoint. According to RFC6749, if the client type is confidential, the client and authorization server establish a client authentication method suitable for the security requirements of the authorization server. The authorization server MAY accept any form of client authentication meeting its security requirements.

How does this work?

OneWelcome supports multiple ways of authenticating oauth2 clients, compliant with RFC specification, such as:

  • client_secret_post
  • client_id and client_secret has to be sent as form data
  • Client_secret_basic
  • client_id and client_secret has to be sent as authorization basic header.
  • none
  • This option has to be set for public clients, where no authentication is needed
  • private_key_jwt
  • requires the client to generate a private&public key pair.

How does private key JWT client authentication works?

In order to use this client authentication method, RP has to generate a private and a public key, and configure the public key on the oauth2 client. For requests to token API, RP has to generate a JWT token which is signed with the private key, and the JWT token created has to contain a set of mandatory claims.

Example of generating public and private key:

Run in terminal the following commands:

Bash
Copy

Example of token request using private key jwt:

Bash
Copy

The optional and mandatory claims the generated JWT needs to have, are below:

ValueDescription
issREQUIRED. Issuer. This MUST contain the client_id of the OAuth Client.
subREQUIRED. Subject. This MUST contain the client_id of the OAuth Client.
audREQUIRED. Audience. The aud (audience) Claim. Value that identifies the Authorization Server as an intended audience. The Authorization Server MUST verify that it is an intended audience for the token. The Audience SHOULD be the URL of the Authorization Server's Token Endpoint.
expREQUIRED. Expiration time on or after which the ID Token MUST NOT be accepted for processing.
iatOPTIONAL. Time at which the JWT was issued.

An example of a decoded JWT payload can be seen below:

JSON
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
  Last updated by Stein Welberg