Package io.camunda.client.impl.oauth
Class OAuthCredentialsProviderBuilder
java.lang.Object
io.camunda.client.impl.oauth.OAuthCredentialsProviderBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Durationstatic final StringHistorical default path for the persistent credentials cache file.static final Durationstatic final Durationstatic final doublestatic final Durationstatic final intstatic final DurationHTTP status codes from the token endpoint that should trigger a retry with backoff.static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyEnvironmentOverrides(boolean applyEnvironmentOverrides) The resource for which the access token should be valid.authorizationServerUrl(String authorizationServerUrl) The authorization server's URL, from which the access token will be requested.build()booleanclientAssertionKeystoreKeyAlias(String clientAssertionKeystoreKeyAlias) clientAssertionKeystoreKeyPassword(String clientAssertionKeystoreKeyPassword) clientAssertionKeystorePassword(String clientAssertionKeystorePassword) clientAssertionKeystorePath(String clientAssertionKeystorePath) clientAssertionKeystorePath(Path clientAssertionKeystorePath) Client id to be used when requesting access token from OAuth authorization server.clientSecret(String clientSecret) Client secret to be used when requesting access token from OAuth authorization server.connectTimeout(Duration connectTimeout) The connection timeout of requests to the OAuth credentials provider.credentialsCachePath(String cachePath) The location for the persistent credentials cache file.doubleintThe URL of the issuer that will issue the access token.keystoreKeyPassword(String keystoreKeyPassword) Keystore key password used for OAuth identity providerkeystorePassword(String keystorePassword) Password to keystore used for OAuth identity providerkeystorePath(Path keystorePath) Path to keystore used for OAuth identity providerproactiveTokenRefreshThreshold(Duration proactiveTokenRefreshThreshold) Window before actual token expiry during which a background refresh is triggered eagerly.readTimeout(Duration readTimeout) The data read timeout of requests to the OAuth credentials provider.The resource for which the access token should be valid.The scopes of the access token.tokenFetchBackoffMultiplier(double tokenFetchBackoffMultiplier) The multiplier applied to the backoff duration between successive token fetch retry attempts.tokenFetchInitialBackoff(Duration tokenFetchInitialBackoff) The initial backoff duration applied between token fetch retry attempts.tokenFetchMaxRetries(int tokenFetchMaxRetries) The maximum number of attempts (including the initial one) when fetching a token from the OAuth authorization server.tokenFetchNonRetryableCooldown(Duration tokenFetchNonRetryableCooldown) The cooldown duration applied after the token endpoint returns a non-retryable response.tokenFetchRetryableStatusCodes(Set<Integer> tokenFetchRetryableStatusCodes) The set of HTTP status codes from the token endpoint that should be retried with backoff.truststorePassword(String truststorePassword) Password to truststore used for OAuth identity providertruststorePath(Path truststorePath) Path to truststore used for OAuth identity providerwellKnownConfigurationUrl(String wellKnownConfigurationUrl) The well known configuration URL of the issuer that will issue the access token.
-
Field Details
-
INVALID_ARGUMENT_MSG
- See Also:
-
DEFAULT_CONNECT_TIMEOUT
-
DEFAULT_READ_TIMEOUT
-
DEFAULT_PROACTIVE_TOKEN_REFRESH_THRESHOLD
-
DEFAULT_CREDENTIALS_CACHE_PATH
Historical default path for the persistent credentials cache file. This path is not applied automatically; file-based caching is opt-in and activates only whencredentialsCachePath(String)is set to a non-empty value (directly, via Spring property, or viaCAMUNDA_CLIENT_CONFIG_PATH). Callers wanting to reproduce the pre-8.10 default behavior can reference this constant explicitly. -
DEFAULT_AUTHZ_SERVER
- See Also:
-
DEFAULT_TOKEN_FETCH_MAX_RETRIES
public static final int DEFAULT_TOKEN_FETCH_MAX_RETRIES- See Also:
-
DEFAULT_TOKEN_FETCH_INITIAL_BACKOFF
-
DEFAULT_TOKEN_FETCH_BACKOFF_MULTIPLIER
public static final double DEFAULT_TOKEN_FETCH_BACKOFF_MULTIPLIER- See Also:
-
DEFAULT_TOKEN_FETCH_NON_RETRYABLE_COOLDOWN
-
DEFAULT_TOKEN_FETCH_RETRYABLE_STATUS_CODES
HTTP status codes from the token endpoint that should trigger a retry with backoff. Any other non-200 status code is treated as a non-retryable failure and trips the latch.IOException(network/timeout) is always retried independently of this set.
-
-
Constructor Details
-
OAuthCredentialsProviderBuilder
public OAuthCredentialsProviderBuilder()
-
-
Method Details
-
clientId
Client id to be used when requesting access token from OAuth authorization server. -
clientSecret
Client secret to be used when requesting access token from OAuth authorization server. -
audience
The resource for which the access token should be valid. -
scope
The scopes of the access token. -
resource
The resource for which the access token should be valid. -
getResource
- See Also:
-
authorizationServerUrl
The authorization server's URL, from which the access token will be requested. -
wellKnownConfigurationUrl
The well known configuration URL of the issuer that will issue the access token. -
issuerUrl
The URL of the issuer that will issue the access token. -
getAuthorizationServer
- See Also:
-
keystorePath
Path to keystore used for OAuth identity provider -
keystorePassword
Password to keystore used for OAuth identity provider -
keystoreKeyPassword
Keystore key password used for OAuth identity provider -
truststorePath
Path to truststore used for OAuth identity provider -
truststorePassword
Password to truststore used for OAuth identity provider -
credentialsCachePath
The location for the persistent credentials cache file. If unset or empty, the provider caches credentials only in memory and does not persist them across restarts — this is the default. Set this to a writable path to opt in to file-based caching; the path must be writable or the first cache write will fail. -
getCredentialsCache
- See Also:
-
connectTimeout
The connection timeout of requests to the OAuth credentials provider. The default value is 5 seconds. Max value isInteger.MAX_VALUEmilliseconds. -
getConnectTimeout
- See Also:
-
readTimeout
The data read timeout of requests to the OAuth credentials provider. The default value is 5 seconds. Max value isInteger.MAX_VALUEmilliseconds. -
getReadTimeout
- See Also:
-
proactiveTokenRefreshThreshold
public OAuthCredentialsProviderBuilder proactiveTokenRefreshThreshold(Duration proactiveTokenRefreshThreshold) Window before actual token expiry during which a background refresh is triggered eagerly. The token remains valid inside this window; this is purely a policy knob controlling how early refresh kicks in, so concurrent callers don't have to block on a synchronous refresh at the cliff edge. Must be strictly larger thanCamundaClientCredentials.EXPIRY_GRACE_PERIOD. The default is 30 seconds. -
getProactiveTokenRefreshThreshold
- See Also:
-
tokenFetchMaxRetries
The maximum number of attempts (including the initial one) when fetching a token from the OAuth authorization server. Retries are only attempted onIOExceptionor HTTP status codes configured viatokenFetchRetryableStatusCodes(Set). The default value is 5. -
getTokenFetchMaxRetries
public int getTokenFetchMaxRetries()- See Also:
-
tokenFetchInitialBackoff
The initial backoff duration applied between token fetch retry attempts. Subsequent delays grow geometrically bytokenFetchBackoffMultiplier(double). The default value is 1 second.If the token endpoint replies with a
Retry-Afterheader, the server-specified delay always takes precedence over the computed backoff, regardless of whether it is shorter or longer. The total retry duration may therefore differ from what theinitialBackoff * multiplier^nprogression alone would suggest. -
getTokenFetchInitialBackoff
- See Also:
-
tokenFetchBackoffMultiplier
public OAuthCredentialsProviderBuilder tokenFetchBackoffMultiplier(double tokenFetchBackoffMultiplier) The multiplier applied to the backoff duration between successive token fetch retry attempts. Must be greater than or equal to 1.0. The default value is 2.0. -
getTokenFetchBackoffMultiplier
public double getTokenFetchBackoffMultiplier()- See Also:
-
tokenFetchRetryableStatusCodes
public OAuthCredentialsProviderBuilder tokenFetchRetryableStatusCodes(Set<Integer> tokenFetchRetryableStatusCodes) The set of HTTP status codes from the token endpoint that should be retried with backoff. Any non-200 status code outside this set trips the non-retryable-failure cooldown: token fetches fail fast for the duration configured viatokenFetchNonRetryableCooldown(Duration)(default 5 minutes), after which the provider automatically probes again. The default isDEFAULT_TOKEN_FETCH_RETRYABLE_STATUS_CODES. Setting this fully replaces the default; callers wanting to extend or shrink the default should derive fromDEFAULT_TOKEN_FETCH_RETRYABLE_STATUS_CODES. -
getTokenFetchRetryableStatusCodes
- See Also:
-
tokenFetchNonRetryableCooldown
public OAuthCredentialsProviderBuilder tokenFetchNonRetryableCooldown(Duration tokenFetchNonRetryableCooldown) The cooldown duration applied after the token endpoint returns a non-retryable response. For the length of this cooldown, all subsequent token fetches fail immediately without contacting the OIDC provider. After the cooldown elapses, the next call clears the latch and attempts a fresh fetch; if it fails again non-retryably, the latch re-arms with a new cooldown. This prevents hammering the OIDC provider during misconfiguration while still allowing automatic recovery from transient non-retryable-looking failures (e.g. credential rotation in-flight, load balancer flaps). The default isDEFAULT_TOKEN_FETCH_NON_RETRYABLE_COOLDOWN. -
getTokenFetchNonRetryableCooldown
- See Also:
-
clientAssertionKeystorePath
public OAuthCredentialsProviderBuilder clientAssertionKeystorePath(String clientAssertionKeystorePath) -
clientAssertionKeystorePath
public OAuthCredentialsProviderBuilder clientAssertionKeystorePath(Path clientAssertionKeystorePath) -
clientAssertionKeystorePassword
public OAuthCredentialsProviderBuilder clientAssertionKeystorePassword(String clientAssertionKeystorePassword) -
clientAssertionKeystoreKeyPassword
public OAuthCredentialsProviderBuilder clientAssertionKeystoreKeyPassword(String clientAssertionKeystoreKeyPassword) -
clientAssertionKeystoreKeyAlias
public OAuthCredentialsProviderBuilder clientAssertionKeystoreKeyAlias(String clientAssertionKeystoreKeyAlias) -
getClientAssertionKeystorePath
-
getClientAssertionKeystorePassword
-
getClientAssertionKeystoreKeyAlias
-
getClientAssertionKeystoreKeyPassword
-
clientAssertionEnabled
public boolean clientAssertionEnabled() -
applyEnvironmentOverrides
-
build
- Returns:
- a new
OAuthCredentialsProviderwith the provided configuration options.
-