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-truefor a client able to keep a secret,falsefor a public client.authMethods- client authentication methods, for exampleclient_secret_basicornone.grantTypes- grant types the client may use, for exampleauthorization_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 (theaudclaim); the client id when none is given.accessTokenTtl- lifetime of access tokens.refreshTokenTtl- lifetime of refresh tokens.accessTokenFormat-self-containedorreference.reuseRefreshTokens-trueto keep a refresh token after use,falseto rotate it.postLogoutRedirectUris- URIs an end-user may be redirected to after an OpenID Connect RP-initiated logout; apost_logout_redirect_urithat 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 verifyprivate_key_jwtassertions and self-signed certificates;nullwhen none.jwks- the client's registered public JWK set as JSON (public keys only), alternative tojwkSetUrl;nullwhen none.tokenEndpointSigningAlgorithm- JWS algorithm the client signs itsprivate_key_jwtassertions with;nullwhen unrestricted.tlsClientAuthSubjectDn- expected subject distinguished name of the certificate of atls_client_authclient;nullwhen 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 Summary
FieldsModifier and TypeFieldDescriptionprivate final StringThe field for theaccessTokenFormatrecord component.private final DurationThe field for theaccessTokenTtlrecord component.The field for theaudiencesrecord component.static final StringPrefix of the authentication methods that use a client secret.static final StringAuthentication method of a client that proves possession of a registered private key.static final StringAuthentication method of mutual TLS with a self-signed certificate.static final StringAuthentication method of mutual TLS with a certificate issued by a trusted authority.The field for theauthMethodsrecord component.private final booleanThe field for thecertificateBoundAccessTokensrecord component.private final StringThe field for theclientIdrecord component.private final booleanThe field for theconfidentialrecord component.static final StringAccess token format of opaque, reference tokens.static final StringAccess token format of self-contained (JWT) tokens.static final StringGrant type of the legacy implicit flow.static final StringGrant type of refresh tokens.The field for thegrantTypesrecord component.private final StringThe field for thejwksrecord component.private final StringThe field for thejwkSetUrlrecord component.private final booleanThe field for themfaRequiredrecord component.private final StringThe field for thenamerecord component.The field for thepostLogoutRedirectUrisrecord component.The field for theredirectUrisrecord component.private final DurationThe field for therefreshTokenTtlrecord component.private final booleanThe field for therequireConsentrecord component.private final booleanThe field for therequireProofKeyrecord component.private final booleanThe field for thereuseRefreshTokensrecord component.The field for thescopesrecord component.private final StringThe field for thetlsClientAuthSubjectDnrecord component.private final StringThe field for thetokenEndpointSigningAlgorithmrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionClientRegistration(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. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaccessTokenFormatrecord component.Returns the value of theaccessTokenTtlrecord component.Returns the value of theaudiencesrecord component.Returns the value of theauthMethodsrecord component.booleanReturns the value of thecertificateBoundAccessTokensrecord component.clientId()Returns the value of theclientIdrecord component.booleanReturns the value of theconfidentialrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thegrantTypesrecord component.final inthashCode()Returns a hash code value for this object.private static booleanisNotPositive(Duration duration) Tells whether a duration is missing, zero or negative.jwks()Returns the value of thejwksrecord component.Returns the value of thejwkSetUrlrecord component.booleanReturns the value of themfaRequiredrecord component.name()Returns the value of thenamerecord component.Returns the value of thepostLogoutRedirectUrisrecord component.Returns the value of theredirectUrisrecord component.Returns the value of therefreshTokenTtlrecord component.booleanReturns the value of therequireConsentrecord component.private static voidrequireNoNulls(List<String> values, String name) Rejects a null list and a list with null elements.booleanReturns the value of therequireProofKeyrecord component.private static voidrequireValidImplicit(boolean confidential, boolean requireConsent, List<String> grantTypes) Refuses animplicitclient that is confidential, requires consent or may use refresh tokens.booleanReturns the value of thereuseRefreshTokensrecord component.scopes()Returns the value of thescopesrecord component.Returns the value of thetlsClientAuthSubjectDnrecord component.Returns the value of thetokenEndpointSigningAlgorithmrecord component.final StringtoString()Returns a string representation of this record class.booleanTells whether the client authenticates with a client secret.booleanTells whether the client may use the legacy implicit grant, which only the legacy demo client seeded under thelegacy-implicitprofile may have.
-
Field Details
-
clientId
The field for theclientIdrecord component. -
name
The field for thenamerecord component. -
confidential
private final boolean confidentialThe field for theconfidentialrecord component. -
authMethods
The field for theauthMethodsrecord component. -
grantTypes
The field for thegrantTypesrecord component. -
redirectUris
The field for theredirectUrisrecord component. -
scopes
The field for thescopesrecord component. -
requireProofKey
private final boolean requireProofKeyThe field for therequireProofKeyrecord component. -
audiences
The field for theaudiencesrecord component. -
accessTokenTtl
The field for theaccessTokenTtlrecord component. -
refreshTokenTtl
The field for therefreshTokenTtlrecord component. -
accessTokenFormat
The field for theaccessTokenFormatrecord component. -
reuseRefreshTokens
private final boolean reuseRefreshTokensThe field for thereuseRefreshTokensrecord component. -
postLogoutRedirectUris
The field for thepostLogoutRedirectUrisrecord component. -
requireConsent
private final boolean requireConsentThe field for therequireConsentrecord component. -
mfaRequired
private final boolean mfaRequiredThe field for themfaRequiredrecord component. -
jwkSetUrl
The field for thejwkSetUrlrecord component. -
jwks
The field for thejwksrecord component. -
tokenEndpointSigningAlgorithm
The field for thetokenEndpointSigningAlgorithmrecord component. -
tlsClientAuthSubjectDn
The field for thetlsClientAuthSubjectDnrecord component. -
certificateBoundAccessTokens
private final boolean certificateBoundAccessTokensThe field for thecertificateBoundAccessTokensrecord component. -
FORMAT_SELF_CONTAINED
Access token format of self-contained (JWT) tokens.- See Also:
-
GRANT_IMPLICIT
Grant type of the legacy implicit flow.- See Also:
-
GRANT_REFRESH_TOKEN
Grant type of refresh tokens.- See Also:
-
AUTH_PRIVATE_KEY_JWT
Authentication method of a client that proves possession of a registered private key.- See Also:
-
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
Authentication method of mutual TLS with a self-signed certificate.- See Also:
-
AUTH_CLIENT_SECRET_PREFIX
Prefix of the authentication methods that use a client secret.- See Also:
-
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 isimplicit), animplicitclient is confidential, requires consent or has refresh tokens, atls_client_authclient has no subject DN, aprivate_key_jwtorself_signed_tls_client_authclient has neitherjwksnorjwkSetUrl, 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 thelegacy-implicitprofile may have.- Returns:
truewhen the grant types containimplicit.
-
usesClientSecret
public boolean usesClientSecret()Tells whether the client authenticates with a client secret.- Returns:
truewhen any authentication method is aclient_secret_*one.
-
requireValidImplicit
private static void requireValidImplicit(boolean confidential, boolean requireConsent, List<String> grantTypes) Refuses animplicitclient 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
Tells whether a duration is missing, zero or negative.- Parameters:
duration- the duration.- Returns:
truewhen it is not a positive duration.
-
requireNoNulls
Rejects a null list and a list with null elements.- Parameters:
values- the list.name- name of the list, for the message.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
clientId
Returns the value of theclientIdrecord component.- Returns:
- the value of the
clientIdrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
confidential
public boolean confidential()Returns the value of theconfidentialrecord component.- Returns:
- the value of the
confidentialrecord component
-
authMethods
Returns the value of theauthMethodsrecord component.- Returns:
- the value of the
authMethodsrecord component
-
grantTypes
Returns the value of thegrantTypesrecord component.- Returns:
- the value of the
grantTypesrecord component
-
redirectUris
Returns the value of theredirectUrisrecord component.- Returns:
- the value of the
redirectUrisrecord component
-
scopes
Returns the value of thescopesrecord component.- Returns:
- the value of the
scopesrecord component
-
requireProofKey
public boolean requireProofKey()Returns the value of therequireProofKeyrecord component.- Returns:
- the value of the
requireProofKeyrecord component
-
audiences
Returns the value of theaudiencesrecord component.- Returns:
- the value of the
audiencesrecord component
-
accessTokenTtl
Returns the value of theaccessTokenTtlrecord component.- Returns:
- the value of the
accessTokenTtlrecord component
-
refreshTokenTtl
Returns the value of therefreshTokenTtlrecord component.- Returns:
- the value of the
refreshTokenTtlrecord component
-
accessTokenFormat
Returns the value of theaccessTokenFormatrecord component.- Returns:
- the value of the
accessTokenFormatrecord component
-
reuseRefreshTokens
public boolean reuseRefreshTokens()Returns the value of thereuseRefreshTokensrecord component.- Returns:
- the value of the
reuseRefreshTokensrecord component
-
postLogoutRedirectUris
Returns the value of thepostLogoutRedirectUrisrecord component.- Returns:
- the value of the
postLogoutRedirectUrisrecord component
-
requireConsent
public boolean requireConsent()Returns the value of therequireConsentrecord component.- Returns:
- the value of the
requireConsentrecord component
-
mfaRequired
public boolean mfaRequired()Returns the value of themfaRequiredrecord component.- Returns:
- the value of the
mfaRequiredrecord component
-
jwkSetUrl
Returns the value of thejwkSetUrlrecord component.- Returns:
- the value of the
jwkSetUrlrecord component
-
jwks
Returns the value of thejwksrecord component.- Returns:
- the value of the
jwksrecord component
-
tokenEndpointSigningAlgorithm
Returns the value of thetokenEndpointSigningAlgorithmrecord component.- Returns:
- the value of the
tokenEndpointSigningAlgorithmrecord component
-
tlsClientAuthSubjectDn
Returns the value of thetlsClientAuthSubjectDnrecord component.- Returns:
- the value of the
tlsClientAuthSubjectDnrecord component
-
certificateBoundAccessTokens
public boolean certificateBoundAccessTokens()Returns the value of thecertificateBoundAccessTokensrecord component.- Returns:
- the value of the
certificateBoundAccessTokensrecord component
-