Record Class OidcClientCredentials

java.lang.Object
java.lang.Record
io.fluxzero.idp.client.OidcClientCredentials
Record Components:
tokenEndpointAuthMethod - token endpoint authentication method
privateJwk - RSA private JWK for private_key_jwt; never expose this to browser code
tokenEndpointAudience - optional audience for the client assertion, defaults to token endpoint

public record OidcClientCredentials(OidcTokenEndpointAuthMethod tokenEndpointAuthMethod, String privateJwk, String tokenEndpointAudience) extends Record
Credentials used by a confidential application when exchanging an authorization code.

The default is a public PKCE client with no token endpoint authentication. Production BFF applications should normally use privateKeyJwt(String) or privateKeyJwt(String, String) so the backend proves possession of the registered client key without sending a reusable client secret.

  • Constructor Details

  • Method Details

    • none

      public static OidcClientCredentials none()
    • privateKeyJwt

      public static OidcClientCredentials privateKeyJwt(String privateJwk)
    • privateKeyJwt

      public static OidcClientCredentials privateKeyJwt(String privateJwk, String tokenEndpointAudience)
    • addToTokenRequest

      public void addToTokenRequest(Map<String,Object> form, String clientId, String tokenEndpoint)
      Adds the configured client authentication fields to a token request form.
      Parameters:
      form - mutable token request form
      clientId - OIDC client id
      tokenEndpoint - discovered token endpoint URL
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • tokenEndpointAuthMethod

      public OidcTokenEndpointAuthMethod tokenEndpointAuthMethod()
      Returns the value of the tokenEndpointAuthMethod record component.
      Returns:
      the value of the tokenEndpointAuthMethod record component
    • privateJwk

      public String privateJwk()
      Returns the value of the privateJwk record component.
      Returns:
      the value of the privateJwk record component
    • tokenEndpointAudience

      public String tokenEndpointAudience()
      Returns the value of the tokenEndpointAudience record component.
      Returns:
      the value of the tokenEndpointAudience record component