Package com.rabbitmq.client.impl
Class OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder
- java.lang.Object
-
- com.rabbitmq.client.impl.OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder
-
- Enclosing class:
- OAuth2ClientCredentialsGrantCredentialsProvider
public static class OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder extends java.lang.Object
Helper to createOAuth2ClientCredentialsGrantCredentialsProvider
instances.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
clientId
private java.lang.String
clientSecret
private java.util.function.Consumer<java.net.HttpURLConnection>
connectionConfigurator
private java.lang.String
grantType
private java.util.Map<java.lang.String,java.lang.String>
parameters
private OAuth2ClientCredentialsGrantCredentialsProvider.TlsConfiguration
tlsConfiguration
private java.lang.String
tokenEndpointUri
-
Constructor Summary
Constructors Constructor Description OAuth2ClientCredentialsGrantCredentialsProviderBuilder()
-
Method Summary
-
-
-
Field Detail
-
parameters
private final java.util.Map<java.lang.String,java.lang.String> parameters
-
tokenEndpointUri
private java.lang.String tokenEndpointUri
-
clientId
private java.lang.String clientId
-
clientSecret
private java.lang.String clientSecret
-
grantType
private java.lang.String grantType
-
connectionConfigurator
private java.util.function.Consumer<java.net.HttpURLConnection> connectionConfigurator
-
tlsConfiguration
private OAuth2ClientCredentialsGrantCredentialsProvider.TlsConfiguration tlsConfiguration
-
-
Method Detail
-
tokenEndpointUri
public OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder tokenEndpointUri(java.lang.String tokenEndpointUri)
Set the URI to request to get the token.- Parameters:
tokenEndpointUri
-- Returns:
- this builder instance
-
clientId
public OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder clientId(java.lang.String clientId)
Set the OAuth 2 client IDThe client ID usually identifies the application that requests a token.
- Parameters:
clientId
-- Returns:
- this builder instance
-
clientSecret
public OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder clientSecret(java.lang.String clientSecret)
Set the secret (password) to use to get a token.- Parameters:
clientSecret
-- Returns:
- this builder instance
-
grantType
public OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder grantType(java.lang.String grantType)
Set the grant type to use when requesting the token.The default is
client_credentials
, but some OAuth 2 servers can use non-standard grant types to request tokens with extra-information.- Parameters:
grantType
-- Returns:
- this builder instance
-
parameter
public OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder parameter(java.lang.String name, java.lang.String value)
Extra parameters to pass in the request.These parameters can be used by the OAuth 2 server to narrow down the identify of the user.
- Parameters:
name
-value
-- Returns:
- this builder instance
-
connectionConfigurator
public OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder connectionConfigurator(java.util.function.Consumer<java.net.HttpURLConnection> connectionConfigurator)
A hook to configure theHttpURLConnection
before the request is sent.Can be used to configuration settings like timeouts.
- Parameters:
connectionConfigurator
-- Returns:
- this builder instance
-
tls
public OAuth2ClientCredentialsGrantCredentialsProvider.TlsConfiguration tls()
Get access to the TLS configuration to get the token on HTTPS.It is recommended that applications in production use HTTPS and configure it properly to perform token retrieval. Not doing so could result in sensitive data transiting in clear on the network.
You can "exit" the TLS configuration and come back to the builder by calling
OAuth2ClientCredentialsGrantCredentialsProvider.TlsConfiguration.builder()
.- Returns:
- the TLS configuration for this builder.
- See Also:
OAuth2ClientCredentialsGrantCredentialsProvider.TlsConfiguration
,OAuth2ClientCredentialsGrantCredentialsProvider.TlsConfiguration.builder()
-
build
public OAuth2ClientCredentialsGrantCredentialsProvider build()
Create theOAuth2ClientCredentialsGrantCredentialsProvider
instance.- Returns:
-
-