Class AbstractOAuth2ClientRegistration.AbstractBuilder<T extends AbstractOAuth2ClientRegistration,B extends AbstractOAuth2ClientRegistration.AbstractBuilder<T,B>>

java.lang.Object
org.springframework.security.oauth2.server.authorization.AbstractOAuth2ClientRegistration.AbstractBuilder<T,B>
Type Parameters:
T - the type of object
B - the type of the builder
Direct Known Subclasses:
OAuth2ClientRegistration.Builder, OidcClientRegistration.Builder
Enclosing class:
AbstractOAuth2ClientRegistration

protected abstract static class AbstractOAuth2ClientRegistration.AbstractBuilder<T extends AbstractOAuth2ClientRegistration,B extends AbstractOAuth2ClientRegistration.AbstractBuilder<T,B>> extends Object
A builder for subclasses of AbstractOAuth2ClientRegistration.
  • Constructor Details

    • AbstractBuilder

      protected AbstractBuilder()
  • Method Details

    • getClaims

      protected Map<String,Object> getClaims()
    • getThis

      protected final B getThis()
    • clientId

      public B clientId(String clientId)
      Sets the Client Identifier, REQUIRED.
      Parameters:
      clientId - the Client Identifier
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • clientIdIssuedAt

      public B clientIdIssuedAt(Instant clientIdIssuedAt)
      Sets the time at which the Client Identifier was issued, OPTIONAL.
      Parameters:
      clientIdIssuedAt - the time at which the Client Identifier was issued
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • clientSecret

      public B clientSecret(String clientSecret)
      Sets the Client Secret, OPTIONAL.
      Parameters:
      clientSecret - the Client Secret
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • clientSecretExpiresAt

      public B clientSecretExpiresAt(Instant clientSecretExpiresAt)
      Sets the time at which the client_secret will expire or null if it will not expire, REQUIRED if client_secret was issued.
      Parameters:
      clientSecretExpiresAt - the time at which the client_secret will expire or null if it will not expire
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • clientName

      public B clientName(String clientName)
      Sets the name of the Client to be presented to the End-User, OPTIONAL.
      Parameters:
      clientName - the name of the Client to be presented to the End-User
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • redirectUri

      public B redirectUri(String redirectUri)
      Add the redirection URI used by the Client, REQUIRED for redirect-based flows.
      Parameters:
      redirectUri - the redirection URI used by the Client
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • redirectUris

      public B redirectUris(Consumer<List<String>> redirectUrisConsumer)
      A Consumer of the redirection URI values used by the Client, allowing the ability to add, replace, or remove, REQUIRED for redirect-based flows.
      Parameters:
      redirectUrisConsumer - a Consumer of the redirection URI values used by the Client
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • tokenEndpointAuthenticationMethod

      public B tokenEndpointAuthenticationMethod(String tokenEndpointAuthenticationMethod)
      Sets the authentication method used by the Client for the Token Endpoint, OPTIONAL.
      Parameters:
      tokenEndpointAuthenticationMethod - the authentication method used by the Client for the Token Endpoint
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • grantType

      public B grantType(String grantType)
      Add the OAuth 2.0 grant_type that the Client will restrict itself to using, OPTIONAL.
      Parameters:
      grantType - the OAuth 2.0 grant_type that the Client will restrict itself to using
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • grantTypes

      public B grantTypes(Consumer<List<String>> grantTypesConsumer)
      A Consumer of the OAuth 2.0 grant_type values that the Client will restrict itself to using, allowing the ability to add, replace, or remove, OPTIONAL.
      Parameters:
      grantTypesConsumer - a Consumer of the OAuth 2.0 grant_type values that the Client will restrict itself to using
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • responseType

      public B responseType(String responseType)
      Add the OAuth 2.0 response_type that the Client will restrict itself to using, OPTIONAL.
      Parameters:
      responseType - the OAuth 2.0 response_type that the Client will restrict itself to using
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • responseTypes

      public B responseTypes(Consumer<List<String>> responseTypesConsumer)
      A Consumer of the OAuth 2.0 response_type values that the Client will restrict itself to using, allowing the ability to add, replace, or remove, OPTIONAL.
      Parameters:
      responseTypesConsumer - a Consumer of the OAuth 2.0 response_type values that the Client will restrict itself to using
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • scope

      public B scope(String scope)
      Add the OAuth 2.0 scope that the Client will restrict itself to using, OPTIONAL.
      Parameters:
      scope - the OAuth 2.0 scope that the Client will restrict itself to using
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • scopes

      public B scopes(Consumer<List<String>> scopesConsumer)
      A Consumer of the OAuth 2.0 scope values that the Client will restrict itself to using, allowing the ability to add, replace, or remove, OPTIONAL.
      Parameters:
      scopesConsumer - a Consumer of the OAuth 2.0 scope values that the Client will restrict itself to using
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • jwkSetUrl

      public B jwkSetUrl(String jwkSetUrl)
      Sets the URL for the Client's JSON Web Key Set, OPTIONAL.
      Parameters:
      jwkSetUrl - the URL for the Client's JSON Web Key Set
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • claim

      public B claim(String name, Object value)
      Sets the claim.
      Parameters:
      name - the claim name
      value - the claim value
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configuration
    • claims

      public B claims(Consumer<Map<String,Object>> claimsConsumer)
      Provides access to every claim(String, Object) declared so far allowing the ability to add, replace, or remove.
      Parameters:
      claimsConsumer - a Consumer of the claims
      Returns:
      the AbstractOAuth2ClientRegistration.AbstractBuilder for further configurations
    • build

      public abstract T build()
      Validate the claims and build the AbstractOAuth2ClientRegistration.
      Returns:
      the AbstractOAuth2ClientRegistration
    • validate

      protected void validate()