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