Package com.helixframework.okhttp.oauth
Class ClientCredentialsOAuthInterceptor.Builder
java.lang.Object
com.helixframework.okhttp.oauth.ClientCredentialsOAuthInterceptor.Builder
- Enclosing class:
- ClientCredentialsOAuthInterceptor
Builder for creating new instances of
ClientCredentialsOAuthInterceptor.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a new instance ofClientCredentialsOAuthInterceptor.credentials(String clientId, String clientSecret) Sets the `client_id` and `client_secret` that will be used for authenticating with the authorization server.Disables sending the client credentials in the Authorization header; instead sending them as form url-encoded parameters.Disables strict response code checking from the downstream service.httpClient(okhttp3.OkHttpClient httpClient) Custom http client to use for refreshing the auth token.Sets the 'scope' to use for the client credentials grant.tokenEndpoint(String url) Sets the token endpoint url of the authorization server that will issue the access tokens.tokenStore(TokenStore tokenStore) Sets the token storage mechanism to use.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
tokenEndpoint
Sets the token endpoint url of the authorization server that will issue the access tokens.This setting is required.
- Parameters:
url- token endpoint url- Returns:
ClientCredentialsOAuthInterceptor.Builder
-
credentials
Sets the `client_id` and `client_secret` that will be used for authenticating with the authorization server.This setting is required.
- Parameters:
clientId- oauth client idclientSecret- oauth client secret- Returns:
ClientCredentialsOAuthInterceptor.Builder
-
scope
Sets the 'scope' to use for the client credentials grant.This is an optional setting.
- Parameters:
scope- oauth client credentials scope- Returns:
ClientCredentialsOAuthInterceptor.Builder
-
tokenStore
Sets the token storage mechanism to use. If not set, the default in-memory token storage will be used.This is an optional setting.
- Parameters:
tokenStore- token store- Returns:
ClientCredentialsOAuthInterceptor.Builder
-
disableStrictMode
Disables strict response code checking from the downstream service. When disabled, the interceptor will attempt to reauthenticate in the event of both 401 and 403 response codes. If left enabled (default), the interceptor will only attempt to reauthenticate in the event it receives a 401 response code from the downstream system.This is an optional setting.
-
disableAuthorizationHeader
Disables sending the client credentials in the Authorization header; instead sending them as form url-encoded parameters. -
httpClient
Custom http client to use for refreshing the auth token. This is useful when you need to configure a corporate proxy or other such custom scenario.This is an optional setting.
- Parameters:
httpClient- http client- Returns:
ClientCredentialsOAuthInterceptor.Builder
-
build
Creates a new instance ofClientCredentialsOAuthInterceptor.- Returns:
- a
ClientCredentialsOAuthInterceptor - Throws:
IllegalArgumentException- when validation of the builder parameters fails
-