Class ClientRegistration.Builder
java.lang.Object
org.springframework.security.oauth2.client.registration.ClientRegistration.Builder
- All Implemented Interfaces:
Serializable
- Enclosing class:
- ClientRegistration
A builder for
ClientRegistration
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionauthorizationGrantType
(AuthorizationGrantType authorizationGrantType) Sets theauthorization grant type
used for the client.authorizationUri
(String authorizationUri) Sets the uri for the authorization endpoint.build()
Builds a newClientRegistration
.clientAuthenticationMethod
(ClientAuthenticationMethod clientAuthenticationMethod) Sets theauthentication method
used when authenticating the client with the authorization server.Sets the client identifier.clientName
(String clientName) Sets the logical name of the client or registration.clientSecret
(String clientSecret) Sets the client secret.Sets the issuer identifier uri for the OpenID Connect 1.0 provider or the OAuth 2.0 Authorization Server.Sets the uri for the JSON Web Key (JWK) Set endpoint.providerConfigurationMetadata
(Map<String, Object> configurationMetadata) Sets the metadata describing the provider's configuration.redirectUri
(String redirectUri) Sets the uri (or uri template) for the redirection endpoint.redirectUriTemplate
(String redirectUriTemplate) Deprecated.registrationId
(String registrationId) Sets the registration id.Sets the scope(s) used for the client.scope
(Collection<String> scope) Sets the scope(s) used for the client.Sets the uri for the token endpoint.userInfoAuthenticationMethod
(AuthenticationMethod userInfoAuthenticationMethod) Sets the authentication method for the user info endpoint.userInfoUri
(String userInfoUri) Sets the uri for the user info endpoint.userNameAttributeName
(String userNameAttributeName) Sets the attribute name used to access the user's name from the user info response.
-
Method Details
-
registrationId
Sets the registration id.- Parameters:
registrationId
- the registration id- Returns:
- the
ClientRegistration.Builder
-
clientId
Sets the client identifier.- Parameters:
clientId
- the client identifier- Returns:
- the
ClientRegistration.Builder
-
clientSecret
Sets the client secret.- Parameters:
clientSecret
- the client secret- Returns:
- the
ClientRegistration.Builder
-
clientAuthenticationMethod
public ClientRegistration.Builder clientAuthenticationMethod(ClientAuthenticationMethod clientAuthenticationMethod) Sets theauthentication method
used when authenticating the client with the authorization server.- Parameters:
clientAuthenticationMethod
- the authentication method used for the client- Returns:
- the
ClientRegistration.Builder
-
authorizationGrantType
public ClientRegistration.Builder authorizationGrantType(AuthorizationGrantType authorizationGrantType) Sets theauthorization grant type
used for the client.- Parameters:
authorizationGrantType
- the authorization grant type used for the client- Returns:
- the
ClientRegistration.Builder
-
redirectUriTemplate
Deprecated.UseredirectUri(String)
insteadSets the uri (or uri template) for the redirection endpoint.- Parameters:
redirectUriTemplate
- the uri (or uri template) for the redirection endpoint- Returns:
- the
ClientRegistration.Builder
-
redirectUri
Sets 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.- Parameters:
redirectUri
- the uri (or uri template) for the redirection endpoint- Returns:
- the
ClientRegistration.Builder
- Since:
- 5.4
-
scope
Sets the scope(s) used for the client.- Parameters:
scope
- the scope(s) used for the client- Returns:
- the
ClientRegistration.Builder
-
scope
Sets the scope(s) used for the client.- Parameters:
scope
- the scope(s) used for the client- Returns:
- the
ClientRegistration.Builder
-
authorizationUri
Sets the uri for the authorization endpoint.- Parameters:
authorizationUri
- the uri for the authorization endpoint- Returns:
- the
ClientRegistration.Builder
-
tokenUri
Sets the uri for the token endpoint.- Parameters:
tokenUri
- the uri for the token endpoint- Returns:
- the
ClientRegistration.Builder
-
userInfoUri
Sets the uri for the user info endpoint.- Parameters:
userInfoUri
- the uri for the user info endpoint- Returns:
- the
ClientRegistration.Builder
-
userInfoAuthenticationMethod
public ClientRegistration.Builder userInfoAuthenticationMethod(AuthenticationMethod userInfoAuthenticationMethod) Sets the authentication method for the user info endpoint.- Parameters:
userInfoAuthenticationMethod
- the authentication method for the user info endpoint- Returns:
- the
ClientRegistration.Builder
- Since:
- 5.1
-
userNameAttributeName
Sets the attribute name used to access the user's name from the user info response.- Parameters:
userNameAttributeName
- the attribute name used to access the user's name from the user info response- Returns:
- the
ClientRegistration.Builder
-
jwkSetUri
Sets the uri for the JSON Web Key (JWK) Set endpoint.- Parameters:
jwkSetUri
- the uri for the JSON Web Key (JWK) Set endpoint- Returns:
- the
ClientRegistration.Builder
-
issuerUri
Sets the issuer identifier uri for the OpenID Connect 1.0 provider or the OAuth 2.0 Authorization Server.- Parameters:
issuerUri
- the issuer identifier uri for the OpenID Connect 1.0 provider or the OAuth 2.0 Authorization Server- Returns:
- the
ClientRegistration.Builder
- Since:
- 5.4
-
providerConfigurationMetadata
public ClientRegistration.Builder providerConfigurationMetadata(Map<String, Object> configurationMetadata) Sets the metadata describing the provider's configuration.- Parameters:
configurationMetadata
- the metadata describing the provider's configuration- Returns:
- the
ClientRegistration.Builder
- Since:
- 5.1
-
clientName
Sets the logical name of the client or registration.- Parameters:
clientName
- the client or registration name- Returns:
- the
ClientRegistration.Builder
-
build
Builds a newClientRegistration
.- Returns:
- a
ClientRegistration
-
redirectUri(String)
instead