Class OAuth2Options.Builder
java.lang.Object
com.sap.cloud.sdk.cloudplatform.connectivity.OAuth2Options.Builder
- Enclosing class:
- OAuth2Options
A builder implementation that helps with creating customized
OAuth2Options instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a newOAuth2Optionsinstance.withClientKeyStore(KeyStore clientKeyStore) Sets theKeyStoreto use for building an mTLS connection towards the target system.withSkipTokenRetrieval(boolean skipTokenRetrieval) Indicates whether to skip the OAuth2 token flow.Set a custom timeout for token retrieval.withTokenCacheParameters(OAuth2Options.TokenCacheParameters tokenCacheParameters) Set a custom token cache configuration.withTokenRetrievalParameter(String key, String value) Adds (or overwrites) the provided key-value-pair to theOAuth2Options.getAdditionalTokenRetrievalParameters()of the to-be-createdOAuth2Optionsinstance.withTokenRetrievalParameters(Map<String, String> parameters) Adds (or overwrites) the provided parameters to theOAuth2Options.getAdditionalTokenRetrievalParameters()of the to-be-createdOAuth2Optionsinstance.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withSkipTokenRetrieval
Indicates whether to skip the OAuth2 token flow.- Parameters:
skipTokenRetrieval-trueif the token retrieval should be skipped,falseotherwise.- Returns:
- This
OAuth2Options.Builder.
-
withTokenRetrievalParameter
@Nonnull public OAuth2Options.Builder withTokenRetrievalParameter(@Nonnull String key, @Nonnull String value) Adds (or overwrites) the provided key-value-pair to theOAuth2Options.getAdditionalTokenRetrievalParameters()of the to-be-createdOAuth2Optionsinstance.- Parameters:
key- The parameter key.value- The parameter value.- Returns:
- This
OAuth2Options.Builder.
-
withTokenRetrievalParameters
@Nonnull public OAuth2Options.Builder withTokenRetrievalParameters(@Nonnull Map<String, String> parameters) Adds (or overwrites) the provided parameters to theOAuth2Options.getAdditionalTokenRetrievalParameters()of the to-be-createdOAuth2Optionsinstance.- Parameters:
parameters- The parameters to add.- Returns:
- This
OAuth2Options.Builder.
-
withClientKeyStore
Sets theKeyStoreto use for building an mTLS connection towards the target system. ThisKeyStoreis not used to build an mTLS connection towards the OAuth2 token service.- Parameters:
clientKeyStore- TheKeyStoreto use for building an mTLS connection towards the target system.- Returns:
- This
OAuth2Options.Builder.
-
withTimeLimiter
@Nonnull public OAuth2Options.Builder withTimeLimiter(@Nonnull ResilienceConfiguration.TimeLimiterConfiguration timeLimiter) Set a custom timeout for token retrieval.OAuth2Options.DEFAULT_TIMEOUTby default.- Parameters:
timeLimiter- The custom timeout configuration.- Returns:
- This
OAuth2Options.Builder. - Since:
- 5.12.0
-
withTokenCacheParameters
@Nonnull public OAuth2Options.Builder withTokenCacheParameters(@Nonnull OAuth2Options.TokenCacheParameters tokenCacheParameters) Set a custom token cache configuration.OAuth2Options.DEFAULT_TOKEN_CACHE_PARAMETERSby default.- Parameters:
tokenCacheParameters- The custom token cache parameters.- Returns:
- This
OAuth2Options.Builder. - Since:
- 5.21.0
-
build
Creates a newOAuth2Optionsinstance.- Returns:
- A new
OAuth2Optionsinstance.
-