java.lang.Object
org.springframework.security.oauth2.client.registration.ClientRegistration
All Implemented Interfaces:
Serializable

public final class ClientRegistration extends Object implements Serializable
A representation of a client registration with an OAuth 2.0 or OpenID Connect 1.0 Provider.
Since:
5.0
See Also:
  • Method Details

    • getRegistrationId

      public String getRegistrationId()
      Returns the identifier for the registration.
      Returns:
      the identifier for the registration
    • getClientId

      public String getClientId()
      Returns the client identifier.
      Returns:
      the client identifier
    • getClientSecret

      public String getClientSecret()
      Returns the client secret.
      Returns:
      the client secret
    • getClientAuthenticationMethod

      public ClientAuthenticationMethod getClientAuthenticationMethod()
      Returns the authentication method used when authenticating the client with the authorization server.
      Returns:
      the ClientAuthenticationMethod
    • getAuthorizationGrantType

      public AuthorizationGrantType getAuthorizationGrantType()
      Returns the authorization grant type used for the client.
      Returns:
      the AuthorizationGrantType
    • getRedirectUriTemplate

      @Deprecated public String getRedirectUriTemplate()
      Deprecated.
      Use getRedirectUri() instead
      Returns the uri (or uri template) for the redirection endpoint.
      Returns:
      the uri (or uri template) for the redirection endpoint
    • getRedirectUri

      public String getRedirectUri()
      Returns the uri (or uri template) for the redirection endpoint.
      The supported uri template variables are: {baseScheme}, {baseHost}, {basePort}, {basePath} and {registrationId}.
      NOTE: {baseUrl} is also supported, which is the same as {baseScheme}://{baseHost}{basePort}{basePath}.
      Configuring uri template variables is especially useful when the client is running behind a Proxy Server. This ensures that the X-Forwarded-* headers are used when expanding the redirect-uri.
      Returns:
      the uri (or uri template) for the redirection endpoint
      Since:
      5.4
    • getScopes

      public Set<String> getScopes()
      Returns the scope(s) used for the client.
      Returns:
      the Set of scope(s)
    • getProviderDetails

      public ClientRegistration.ProviderDetails getProviderDetails()
      Returns the details of the provider.
      Returns:
      the ClientRegistration.ProviderDetails
    • getClientName

      public String getClientName()
      Returns the logical name of the client or registration.
      Returns:
      the client or registration name
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • withRegistrationId

      public static ClientRegistration.Builder withRegistrationId(String registrationId)
      Returns a new ClientRegistration.Builder, initialized with the provided registration identifier.
      Parameters:
      registrationId - the identifier for the registration
      Returns:
      the ClientRegistration.Builder
    • withClientRegistration

      public static ClientRegistration.Builder withClientRegistration(ClientRegistration clientRegistration)
      Returns a new ClientRegistration.Builder, initialized with the provided ClientRegistration.
      Parameters:
      clientRegistration - the ClientRegistration to copy from
      Returns:
      the ClientRegistration.Builder