Record Class ClientRegistration

java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.domain.clients.ClientRegistration
Record Components:
clientId - public identifier of the client.
name - human readable name.
confidential - true for a client able to keep a secret, false for a public client.
authMethods - client authentication methods, for example client_secret_basic or none.
grantTypes - grant types the client may use, for example authorization_code.
redirectUris - redirect URIs the client may use.
scopes - scopes the client may request.
requireProofKey - whether the authorization code flow must use PKCE.
audiences - logical identifiers of the APIs the access tokens are meant for (the aud claim); the client id when none is given.
accessTokenTtl - lifetime of access tokens.
refreshTokenTtl - lifetime of refresh tokens.
accessTokenFormat - self-contained or reference.
reuseRefreshTokens - true to keep a refresh token after use, false to rotate it.
postLogoutRedirectUris - URIs an end-user may be redirected to after an OpenID Connect RP-initiated logout; a post_logout_redirect_uri that is not listed is never honoured.
requireConsent - whether the end-user must explicitly grant the requested scopes on a consent page.
mfaRequired - whether every user signing in through the client must complete a second factor.
jwkSetUrl - URL of the client's public JWK set, used to verify private_key_jwt assertions and self-signed certificates; null when none.
jwks - the client's registered public JWK set as JSON (public keys only), alternative to jwkSetUrl; null when none.
tokenEndpointSigningAlgorithm - JWS algorithm the client signs its private_key_jwt assertions with; null when unrestricted.
tlsClientAuthSubjectDn - expected subject distinguished name of the certificate of a tls_client_auth client; null when none.
certificateBoundAccessTokens - whether access tokens are bound to the client certificate (cnf.x5t#S256).

public record ClientRegistration(String clientId, String name, boolean confidential, List<String> authMethods, List<String> grantTypes, List<String> redirectUris, List<String> scopes, boolean requireProofKey, List<String> audiences, Duration accessTokenTtl, Duration refreshTokenTtl, String accessTokenFormat, boolean reuseRefreshTokens, List<String> postLogoutRedirectUris, boolean requireConsent, boolean mfaRequired, String jwkSetUrl, String jwks, String tokenEndpointSigningAlgorithm, String tlsClientAuthSubjectDn, boolean certificateBoundAccessTokens) extends Record
An OAuth 2.1 client registered with the authorization server. The client secret is not part of the model: it is only ever handled encoded, through the repository.
  • Field Details

    • clientId

      private final String clientId
      The field for the clientId record component.
    • name

      private final String name
      The field for the name record component.
    • confidential

      private final boolean confidential
      The field for the confidential record component.
    • authMethods

      private final List<String> authMethods
      The field for the authMethods record component.
    • grantTypes

      private final List<String> grantTypes
      The field for the grantTypes record component.
    • redirectUris

      private final List<String> redirectUris
      The field for the redirectUris record component.
    • scopes

      private final List<String> scopes
      The field for the scopes record component.
    • requireProofKey

      private final boolean requireProofKey
      The field for the requireProofKey record component.
    • audiences

      private final List<String> audiences
      The field for the audiences record component.
    • accessTokenTtl

      private final Duration accessTokenTtl
      The field for the accessTokenTtl record component.
    • refreshTokenTtl

      private final Duration refreshTokenTtl
      The field for the refreshTokenTtl record component.
    • accessTokenFormat

      private final String accessTokenFormat
      The field for the accessTokenFormat record component.
    • reuseRefreshTokens

      private final boolean reuseRefreshTokens
      The field for the reuseRefreshTokens record component.
    • postLogoutRedirectUris

      private final List<String> postLogoutRedirectUris
      The field for the postLogoutRedirectUris record component.
    • requireConsent

      private final boolean requireConsent
      The field for the requireConsent record component.
    • mfaRequired

      private final boolean mfaRequired
      The field for the mfaRequired record component.
    • jwkSetUrl

      private final String jwkSetUrl
      The field for the jwkSetUrl record component.
    • jwks

      private final String jwks
      The field for the jwks record component.
    • tokenEndpointSigningAlgorithm

      private final String tokenEndpointSigningAlgorithm
      The field for the tokenEndpointSigningAlgorithm record component.
    • tlsClientAuthSubjectDn

      private final String tlsClientAuthSubjectDn
      The field for the tlsClientAuthSubjectDn record component.
    • certificateBoundAccessTokens

      private final boolean certificateBoundAccessTokens
      The field for the certificateBoundAccessTokens record component.
    • FORMAT_SELF_CONTAINED

      public static final String FORMAT_SELF_CONTAINED
      Access token format of self-contained (JWT) tokens.
      See Also:
    • GRANT_IMPLICIT

      public static final String GRANT_IMPLICIT
      Grant type of the legacy implicit flow.
      See Also:
    • GRANT_REFRESH_TOKEN

      public static final String GRANT_REFRESH_TOKEN
      Grant type of refresh tokens.
      See Also:
    • AUTH_PRIVATE_KEY_JWT

      public static final String AUTH_PRIVATE_KEY_JWT
      Authentication method of a client that proves possession of a registered private key.
      See Also:
    • AUTH_TLS_CLIENT_AUTH

      public static final String AUTH_TLS_CLIENT_AUTH
      Authentication method of mutual TLS with a certificate issued by a trusted authority.
      See Also:
    • AUTH_SELF_SIGNED_TLS_CLIENT_AUTH

      public static final String AUTH_SELF_SIGNED_TLS_CLIENT_AUTH
      Authentication method of mutual TLS with a self-signed certificate.
      See Also:
    • AUTH_CLIENT_SECRET_PREFIX

      public static final String AUTH_CLIENT_SECRET_PREFIX
      Prefix of the authentication methods that use a client secret.
      See Also:
    • FORMAT_REFERENCE

      public static final String FORMAT_REFERENCE
      Access token format of opaque, reference tokens.
      See Also:
  • Constructor Details

    • ClientRegistration

      public ClientRegistration(String clientId, String name, boolean confidential, List<String> authMethods, List<String> grantTypes, List<String> redirectUris, List<String> scopes, boolean requireProofKey, List<String> audiences, Duration accessTokenTtl, Duration refreshTokenTtl, String accessTokenFormat, boolean reuseRefreshTokens, List<String> postLogoutRedirectUris, boolean requireConsent, boolean mfaRequired, String jwkSetUrl, String jwks, String tokenEndpointSigningAlgorithm, String tlsClientAuthSubjectDn, boolean certificateBoundAccessTokens)
      Validates the registration and defensively copies its collections.
      Throws:
      IllegalArgumentException - if the id, name or format is blank, a collection is null or has a null element, a lifetime is missing or not positive, or a public client does not require PKCE (unless its only grant type is implicit), an implicit client is confidential, requires consent or has refresh tokens, a tls_client_auth client has no subject DN, a private_key_jwt or self_signed_tls_client_auth client has neither jwks nor jwkSetUrl, or a given optional text is blank.
  • Method Details

    • usesImplicit

      public boolean usesImplicit()
      Tells whether the client may use the legacy implicit grant, which only the legacy demo client seeded under the legacy-implicit profile may have.
      Returns:
      true when the grant types contain implicit.
    • usesClientSecret

      public boolean usesClientSecret()
      Tells whether the client authenticates with a client secret.
      Returns:
      true when any authentication method is a client_secret_* one.
    • requireValidImplicit

      private static void requireValidImplicit(boolean confidential, boolean requireConsent, List<String> grantTypes)
      Refuses an implicit client that is confidential, requires consent or may use refresh tokens.
      Parameters:
      confidential - whether the client is confidential.
      requireConsent - whether consent is required.
      grantTypes - the grant types of the client.
    • isNotPositive

      private static boolean isNotPositive(Duration duration)
      Tells whether a duration is missing, zero or negative.
      Parameters:
      duration - the duration.
      Returns:
      true when it is not a positive duration.
    • requireNoNulls

      private static void requireNoNulls(List<String> values, String name)
      Rejects a null list and a list with null elements.
      Parameters:
      values - the list.
      name - name of the list, for the message.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • clientId

      public String clientId()
      Returns the value of the clientId record component.
      Returns:
      the value of the clientId record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • confidential

      public boolean confidential()
      Returns the value of the confidential record component.
      Returns:
      the value of the confidential record component
    • authMethods

      public List<String> authMethods()
      Returns the value of the authMethods record component.
      Returns:
      the value of the authMethods record component
    • grantTypes

      public List<String> grantTypes()
      Returns the value of the grantTypes record component.
      Returns:
      the value of the grantTypes record component
    • redirectUris

      public List<String> redirectUris()
      Returns the value of the redirectUris record component.
      Returns:
      the value of the redirectUris record component
    • scopes

      public List<String> scopes()
      Returns the value of the scopes record component.
      Returns:
      the value of the scopes record component
    • requireProofKey

      public boolean requireProofKey()
      Returns the value of the requireProofKey record component.
      Returns:
      the value of the requireProofKey record component
    • audiences

      public List<String> audiences()
      Returns the value of the audiences record component.
      Returns:
      the value of the audiences record component
    • accessTokenTtl

      public Duration accessTokenTtl()
      Returns the value of the accessTokenTtl record component.
      Returns:
      the value of the accessTokenTtl record component
    • refreshTokenTtl

      public Duration refreshTokenTtl()
      Returns the value of the refreshTokenTtl record component.
      Returns:
      the value of the refreshTokenTtl record component
    • accessTokenFormat

      public String accessTokenFormat()
      Returns the value of the accessTokenFormat record component.
      Returns:
      the value of the accessTokenFormat record component
    • reuseRefreshTokens

      public boolean reuseRefreshTokens()
      Returns the value of the reuseRefreshTokens record component.
      Returns:
      the value of the reuseRefreshTokens record component
    • postLogoutRedirectUris

      public List<String> postLogoutRedirectUris()
      Returns the value of the postLogoutRedirectUris record component.
      Returns:
      the value of the postLogoutRedirectUris record component
    • requireConsent

      public boolean requireConsent()
      Returns the value of the requireConsent record component.
      Returns:
      the value of the requireConsent record component
    • mfaRequired

      public boolean mfaRequired()
      Returns the value of the mfaRequired record component.
      Returns:
      the value of the mfaRequired record component
    • jwkSetUrl

      public String jwkSetUrl()
      Returns the value of the jwkSetUrl record component.
      Returns:
      the value of the jwkSetUrl record component
    • jwks

      public String jwks()
      Returns the value of the jwks record component.
      Returns:
      the value of the jwks record component
    • tokenEndpointSigningAlgorithm

      public String tokenEndpointSigningAlgorithm()
      Returns the value of the tokenEndpointSigningAlgorithm record component.
      Returns:
      the value of the tokenEndpointSigningAlgorithm record component
    • tlsClientAuthSubjectDn

      public String tlsClientAuthSubjectDn()
      Returns the value of the tlsClientAuthSubjectDn record component.
      Returns:
      the value of the tlsClientAuthSubjectDn record component
    • certificateBoundAccessTokens

      public boolean certificateBoundAccessTokens()
      Returns the value of the certificateBoundAccessTokens record component.
      Returns:
      the value of the certificateBoundAccessTokens record component