Package com.okta.authn.sdk.impl.client
Class DefaultAuthenticationClientBuilder
- java.lang.Object
-
- com.okta.authn.sdk.impl.client.DefaultAuthenticationClientBuilder
-
- All Implemented Interfaces:
AuthenticationClientBuilder
public class DefaultAuthenticationClientBuilder extends java.lang.Object implements AuthenticationClientBuilder
The default
AuthenticationClientBuilder
implementation. This looks for configuration files in the following locations and order of precedence (last one wins).- classpath:com/okta/authn/sdk/config/okta.properties
- classpath:com/okta/authn/sdk/config/okta.yaml
- classpath:okta.properties
- classpath:okta.yaml
- ~/.okta/okta.yaml
- Environment Variables (with dot notation converted to uppercase + underscores)
- System Properties
- Programmatically
- Since:
- 0.1.0
-
-
Field Summary
-
Fields inherited from interface com.okta.authn.sdk.client.AuthenticationClientBuilder
DEFAULT_CLIENT_AUTHENTICATION_SCHEME_PROPERTY_NAME, DEFAULT_CLIENT_CONNECTION_TIMEOUT_PROPERTY_NAME, DEFAULT_CLIENT_ORG_URL_PROPERTY_NAME, DEFAULT_CLIENT_PROXY_HOST_PROPERTY_NAME, DEFAULT_CLIENT_PROXY_PASSWORD_PROPERTY_NAME, DEFAULT_CLIENT_PROXY_PORT_PROPERTY_NAME, DEFAULT_CLIENT_PROXY_USERNAME_PROPERTY_NAME, DEFAULT_CLIENT_REQUEST_TIMEOUT_PROPERTY_NAME, DEFAULT_CLIENT_RETRY_MAX_ATTEMPTS_PROPERTY_NAME, DEFAULT_CLIENT_TESTING_DISABLE_HTTPS_CHECK_PROPERTY_NAME
-
-
Constructor Summary
Constructors Constructor Description DefaultAuthenticationClientBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthenticationClient
build()
Constructs a newAuthenticationClient
instance based on the AuthenticationClientBuilder's current configuration state.AuthenticationClientBuilder
setBaseUrlResolver(com.okta.commons.http.config.BaseUrlResolver baseUrlResolver)
AuthenticationClientBuilder
setConnectionTimeout(int timeout)
Sets both the timeout until a connection is established and the socket timeout (i.e.AuthenticationClientBuilder
setOrgUrl(java.lang.String baseUrl)
Sets the base URL of the Okta REST API to use.AuthenticationClientBuilder
setProxy(com.okta.commons.http.config.Proxy proxy)
Sets the HTTP proxy to be used when communicating with the Okta API server.AuthenticationClientBuilder
setRetryMaxAttempts(int maxAttempts)
Sets the maximum number of attempts to retrying before giving up.AuthenticationClientBuilder
setRetryMaxElapsed(int maxElapsed)
Sets the maximum number of milliseconds to wait when retrying before giving up.
-
-
-
Method Detail
-
setProxy
public AuthenticationClientBuilder setProxy(com.okta.commons.http.config.Proxy proxy)
Description copied from interface:AuthenticationClientBuilder
Sets the HTTP proxy to be used when communicating with the Okta API server. For example:Proxy proxy = new Proxy("whatever.domain.com", 443); AuthenticationClient client =
AuthenticationClients
.builder().setProxy(proxy).build();- Specified by:
setProxy
in interfaceAuthenticationClientBuilder
- Parameters:
proxy
- theProxy
you need to use.- Returns:
- the AuthenticationClientBuilder instance for method chaining.
-
setConnectionTimeout
public AuthenticationClientBuilder setConnectionTimeout(int timeout)
Description copied from interface:AuthenticationClientBuilder
Sets both the timeout until a connection is established and the socket timeout (i.e. a maximum period of inactivity between two consecutive data packets). A timeout value of zero is interpreted as an infinite timeout.- Specified by:
setConnectionTimeout
in interfaceAuthenticationClientBuilder
- Parameters:
timeout
- connection and socket timeout in seconds- Returns:
- the AuthenticationClientBuilder instance for method chaining
-
setBaseUrlResolver
public AuthenticationClientBuilder setBaseUrlResolver(com.okta.commons.http.config.BaseUrlResolver baseUrlResolver)
-
setRetryMaxElapsed
public AuthenticationClientBuilder setRetryMaxElapsed(int maxElapsed)
Description copied from interface:AuthenticationClientBuilder
Sets the maximum number of milliseconds to wait when retrying before giving up.- Specified by:
setRetryMaxElapsed
in interfaceAuthenticationClientBuilder
- Parameters:
maxElapsed
- retry max elapsed duration in milliseconds- Returns:
- the ClientBuilder instance for method chaining
-
setRetryMaxAttempts
public AuthenticationClientBuilder setRetryMaxAttempts(int maxAttempts)
Description copied from interface:AuthenticationClientBuilder
Sets the maximum number of attempts to retrying before giving up.- Specified by:
setRetryMaxAttempts
in interfaceAuthenticationClientBuilder
- Parameters:
maxAttempts
- retry max attempts- Returns:
- the ClientBuilder instance for method chaining
-
build
public AuthenticationClient build()
Description copied from interface:AuthenticationClientBuilder
Constructs a newAuthenticationClient
instance based on the AuthenticationClientBuilder's current configuration state.- Specified by:
build
in interfaceAuthenticationClientBuilder
- Returns:
- a new
AuthenticationClient
instance based on the AuthenticationClientBuilder's current configuration state.
-
setOrgUrl
public AuthenticationClientBuilder setOrgUrl(java.lang.String baseUrl)
Description copied from interface:AuthenticationClientBuilder
Sets the base URL of the Okta REST API to use.- Specified by:
setOrgUrl
in interfaceAuthenticationClientBuilder
- Parameters:
baseUrl
- the base URL of the Okta REST API to use.- Returns:
- the AuthenticationClientBuilder instance for method chaining
-
-