Class OAuthClient.Builder
java.lang.Object
com.revetsec.oauth.OAuthClient.Builder
- Enclosing class:
OAuthClient
Configures an OAuth client. Building performs validation only: no discovery, HTTP request or new thread.
- Since:
- 1.0.0
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionAcknowledges the risk of building on an unpatched runtime.Allows plain HTTP to exact loopback hosts for local tests.build()Validates configuration and builds without I/O or thread creation.Sets the client's token-endpoint authentication method.Sets the client identifier registered with the authorization server.Sets the clock used for pending state, token expiry and cache freshness.defaultTimeToLive(@Nullable Duration value) Sets the fallback lifetime when discovery supplies no usable cache lifetime.discoveryCooldown(@Nullable Duration value) Sets the cooldown after a failed discovery attempt.httpClient(@Nullable HttpClient value) Injects an application-managed HTTP client.Sets how the callback issuer parameter is required.maximumTimeToLive(@Nullable Duration value) Sets the highest permitted discovery cache lifetime.minimumTimeToLive(@Nullable Duration value) Sets the lowest permitted discovery cache lifetime.observer(@Nullable OAuthObserver value) Sets the observer for bounded OAuth events.Sets the policy used to approve outbound endpoint URIs.Sets the lifetime of browser-bound pending authorization.redirectUri(@Nullable URI value) Sets the registered redirect URI for authorization-code flows.requestTimeout(@Nullable Duration value) Sets the timeout for one HTTP exchange.Requires metadata to advertise S256 before an authorization flow begins.Sets the default resource indicators for token requests.Sets the scopes used when a request has no scope override.totalDeadline(@Nullable Duration value) Sets the deadline shared by all exchanges in one public call.
-
Method Details
-
clientId
Sets the client identifier registered with the authorization server.- Parameters:
value- nonempty client ID, or null which clears the required setting- Returns:
- this builder
- Since:
- 1.0.0
-
clientAuthentication
Sets the client's token-endpoint authentication method.- Parameters:
value- one client authentication strategy, or null which clears the required setting- Returns:
- this builder
- Since:
- 1.0.0
-
redirectUri
Sets the registered redirect URI for authorization-code flows.- Parameters:
value- exact registered code-flow callback URI, or null for token-only clients- Returns:
- this builder
- Since:
- 1.0.0
-
scopes
-
resources
-
issuerParameterPolicy
Sets how the callback issuer parameter is required.- Parameters:
value- callback issuer policy, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
requirePkceAdvertised
Requires metadata to advertise S256 before an authorization flow begins.- Parameters:
value- whether metadata must advertise S256, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
pendingAuthorizationLifetime
Sets the lifetime of browser-bound pending authorization.- Parameters:
value- pending lifetime from 1 to 60 minutes, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
httpClient
Injects an application-managed HTTP client. It must use Redirect.NEVER and have no Authenticator or CookieHandler; build rejects noncompliance without sending a request. The application owns injected TLS/proxy configuration and network egress beyond the URI policy.- Parameters:
value- injected client meeting these restrictions, or null for the lazy default- Returns:
- this builder
- Since:
- 1.0.0
-
outboundUriPolicy
Sets the policy used to approve outbound endpoint URIs.- Parameters:
value- outbound URI policy, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
requestTimeout
Sets the timeout for one HTTP exchange.- Parameters:
value- per-request timeout, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
totalDeadline
Sets the deadline shared by all exchanges in one public call.- Parameters:
value- total deadline per public call, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
clock
Sets the clock used for pending state, token expiry and cache freshness.- Parameters:
value- clock for token expiry and cache freshness, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
observer
Sets the observer for bounded OAuth events.- Parameters:
value- observer, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
allowInsecureLoopback
Allows plain HTTP to exact loopback hosts for local tests.- Parameters:
value- allow plain HTTP to exact loopback hosts for tests, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
acknowledgeUnpatchedRuntime
Acknowledges the risk of building on an unpatched runtime.- Parameters:
value- explicit acknowledgment of an unpatched runtime, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
minimumTimeToLive
Sets the lowest permitted discovery cache lifetime.- Parameters:
value- minimum discovery cache lifetime, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
defaultTimeToLive
Sets the fallback lifetime when discovery supplies no usable cache lifetime.- Parameters:
value- fallback discovery cache lifetime, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
maximumTimeToLive
Sets the highest permitted discovery cache lifetime.- Parameters:
value- maximum discovery cache lifetime, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
discoveryCooldown
Sets the cooldown after a failed discovery attempt.- Parameters:
value- discovery attempt ceiling window, or null which restores the default- Returns:
- this builder
- Since:
- 1.0.0
-
build
Validates configuration and builds without I/O or thread creation.- Returns:
- the client
- Since:
- 1.0.0
-