Class DefaultClientDefinitions

java.lang.Object
com.irurueta.authserver.authorization.application.clients.DefaultClientDefinitions

public final class DefaultClientDefinitions extends Object
The single definition of the clients a deployment can start with: the confidential bff (backend for frontend) and the public spa-public. Used by the seeder and by the development data initializer, so they never drift apart. Nothing environment-specific lives here: the redirect URIs come from configuration (the dev profile supplies the local ones) and so does the audience of the authorization server's own API. Both clients carry the audience of the resource server and of that API (so a user can change their password through them), may read and delete documents, and never get the admin scope.
  • Field Details

    • BFF_CLIENT_ID

      public static final String BFF_CLIENT_ID
      Client id of the backend for frontend.
      See Also:
    • SPA_PUBLIC_CLIENT_ID

      public static final String SPA_PUBLIC_CLIENT_ID
      Client id of the public single-page application.
      See Also:
    • RESOURCE_SERVER_AUDIENCE

      public static final String RESOURCE_SERVER_AUDIENCE
      Audience of the resource server.
      See Also:
    • TOKEN_EXCHANGE_GRANT

      public static final String TOKEN_EXCHANGE_GRANT
      Grant type URN of the OAuth 2.0 token exchange (RFC 8693) that a client needs to exchange tokens.
      See Also:
    • DEFAULT_API_AUDIENCE

      public static final String DEFAULT_API_AUDIENCE
      Default audience of the authorization server's own REST API (authserver.api.audience).
      See Also:
    • SCOPES

      private static final List<String> SCOPES
      Scopes of both default clients.
    • ACCESS_TOKEN_TTL

      private static final Duration ACCESS_TOKEN_TTL
      Lifetime of access tokens.
    • REFRESH_TOKEN_TTL

      private static final Duration REFRESH_TOKEN_TTL
      Lifetime of refresh tokens.
  • Constructor Details

    • DefaultClientDefinitions

      private DefaultClientDefinitions()
      Not instantiable.
  • Method Details

    • bff

      public static ClientRegistration bff(List<String> redirectUris, String apiAudience)
      Defines the bff client: confidential, client_secret_basic, authorization code with PKCE and refresh tokens, with refresh token rotation on. It requires the end-user's consent to the requested scopes.
      Parameters:
      redirectUris - redirect URIs of the deployment.
      apiAudience - audience of the authorization server's own API.
      Returns:
      the client.
    • bff

      public static ClientRegistration bff(List<String> redirectUris, String apiAudience, List<String> postLogoutRedirectUris)
      Defines the bff client with the URIs it may be sent to after an OpenID Connect RP-initiated logout.
      Parameters:
      redirectUris - redirect URIs of the deployment.
      apiAudience - audience of the authorization server's own API.
      postLogoutRedirectUris - post-logout redirect URIs of the deployment; none when empty.
      Returns:
      the client.
    • spaPublic

      public static ClientRegistration spaPublic(List<String> redirectUris, String apiAudience)
      Defines the spa-public client: public, authorization code with PKCE, no client authentication.
      Parameters:
      redirectUris - redirect URIs of the deployment.
      apiAudience - audience of the authorization server's own API.
      Returns:
      the client.
    • spaPublic

      public static ClientRegistration spaPublic(List<String> redirectUris, String apiAudience, List<String> postLogoutRedirectUris)
      Defines the spa-public client with the URIs it may be sent to after an OpenID Connect RP-initiated logout.
      Parameters:
      redirectUris - redirect URIs of the deployment.
      apiAudience - audience of the authorization server's own API.
      postLogoutRedirectUris - post-logout redirect URIs of the deployment; none when empty.
      Returns:
      the client.