Class OidcClient.Builder
java.lang.Object
com.revetsec.oidc.OidcClient.Builder
- Enclosing class:
OidcClient
Mutable OIDC client configuration. Null restores an optional property's default.
- Since:
- 1.0.0
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionSets explicit acknowledgment of runtime risk.acrPreferences(@Nullable List<@NonNull String> value) Sets ordered acr_values request preferences, independent of local acceptance.Sets whether plain HTTP is allowed for literal loopback tests.build()Validates issuer, explicit metadata and configuration without I/O or new threads.Sets the token endpoint authentication; default public client.Sets the registered nonempty client identifier.Sets the clock for pending state, keys and claims.Sets the time skew, zero to five minutes.Sets the complete per-client compatibility-mode set.defaultTimeToLive(@Nullable Duration value) Sets the fallback discovery cache lifetime.discoveryCooldown(@Nullable Duration value) Sets the discovery attempt window and initial failure backoff.httpClient(@Nullable HttpClient value) Sets the application-managed HTTP client.Sets the complete ID-token algorithm allowlist; default RS256.Sets the callback issuer policy.Selects exact validation or the fixed Entra common/organizations policy.jwksSource(@Nullable JwksSource value) Sets the advanced signing-key source; share only within the same exact issuer trust boundary, or with the same Entra issuer-policy instance.maximumIdTokenAge(@Nullable Duration value) Sets the maximum ID-token age plus skew.maximumTimeToLive(@Nullable Duration value) Sets the highest discovery cache lifetime.minimumTimeToLive(@Nullable Duration value) Sets the lowest discovery cache lifetime.observer(@Nullable OidcObserver value) Sets the caller-thread observer.Sets the outbound URI policy.Sets the pending lifetime, one to sixty minutes.postLogoutRedirectUri(@Nullable URI value) Sets one fixed registered logout callback, independent of the login callback.redirectUri(@Nullable URI value) Sets the exact registered callback URI.requestTimeout(@Nullable Duration value) Sets the per-exchange timeout.requiredAcrValues(@Nullable Set<@NonNull String> value) Sets the complete acceptable ACR defaults.Sets whether S256 advertisement is required.Sets the complete default resource indicators.Sets the complete default scopes, in addition to openid.totalDeadline(@Nullable Duration value) Sets the deadline shared by discovery, code exchange and key lookup.trustedAudiences(@Nullable Set<@NonNull String> value) Sets the complete additional trusted audience set.Sets the complete additional trusted authorized-party set.Sets the exact registered signed-UserInfo algorithm.
-
Method Details
-
clientId
Sets the registered nonempty client identifier.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
clientAuthentication
Sets the token endpoint authentication; default public client.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
redirectUri
Sets the exact registered callback URI.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
postLogoutRedirectUri
Sets one fixed registered logout callback, independent of the login callback. It must be HTTPS (or explicit test loopback), at most 2048 UTF8 bytes, without query, fragment or userinfo. Null disables logout.- Parameters:
value- fixed callback, or null for absent- Returns:
- this builder
- Since:
- 1.0.0
-
scopes
-
resources
-
requiredAcrValues
Sets the complete acceptable ACR defaults.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
acrPreferences
Sets ordered acr_values request preferences, independent of local acceptance. Null derives a deterministic lexical request list from the effective acceptance set; an empty list omits the request parameter.- Parameters:
value- distinct nonempty visible-ASCII preferences, or null- Returns:
- this builder
- Throws:
IllegalArgumentException- if a value is malformed or duplicated- Since:
- 1.0.0
-
trustedAudiences
Sets the complete additional trusted audience set.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
trustedAuthorizedParties
Sets the complete additional trusted authorized-party set.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
idTokenSigningAlgorithms
public @NonNull OidcClient.Builder idTokenSigningAlgorithms(@Nullable Set<@NonNull JwsAlgorithm> value) Sets the complete ID-token algorithm allowlist; default RS256.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
compatibility
public @NonNull OidcClient.Builder compatibility(@Nullable Set<@NonNull OidcCompatibilityMode> value) Sets the complete per-client compatibility-mode set. Null restores no modes. Enabling HMAC does not change the default RS256 allowlist; explicitly name HS algorithms and configure confidential client authentication. Secret suppliers are checked once at build and once per credentialed token POST, before I/O. The exact secret used for that POST verifies its ID token; a later rotation cannot change the call's key.- Parameters:
value- modes, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
userInfoSignedResponseAlgorithm
Sets the exact registered signed-UserInfo algorithm. Null restores JSON responses. This allowlist is separate from the ID-token allowlist; an advertised UserInfo capability set must include it. HMAC compatibility is not enabled. JSON cannot replace a configured signed response.- Parameters:
value- registered signing algorithm, or null for JSON- Returns:
- this builder
- Since:
- 1.0.0
-
jwksSource
Sets the advanced signing-key source; share only within the same exact issuer trust boundary, or with the same Entra issuer-policy instance. Distinct tenant callbacks are not equivalent.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
clockSkew
Sets the time skew, zero to five minutes.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
maximumIdTokenAge
Sets the maximum ID-token age plus skew.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
pendingAuthorizationLifetime
Sets the pending lifetime, one to sixty minutes.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
requestTimeout
Sets the per-exchange timeout.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
totalDeadline
Sets the deadline shared by discovery, code exchange and key lookup.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
clock
Sets the clock for pending state, keys and claims.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
httpClient
Sets the application-managed HTTP client. It must useHttpClient.Redirect.NEVERand have noAuthenticatororCookieHandler; build rejects noncompliance without a network request. Null restores the lazy default. The application owns TLS, proxy and egress controls beyond URI text policy.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
outboundUriPolicy
Sets the outbound URI policy.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
observer
Sets the caller-thread observer.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
issuerPolicy
Selects exact validation or the fixed Entra common/organizations policy. Null restores exact validation. Build performs no tenant callback, key lookup or network request. HMAC ID tokens are incompatible.- Parameters:
value- selected issuer policy, or null to restore exact- Returns:
- this builder
- Since:
- 1.0.0
-
issuerParameterPolicy
Sets the callback issuer policy.- Parameters:
value- value, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
requirePkceAdvertised
Sets whether S256 advertisement is required.- Parameters:
value- the flag, or null to restore false- Returns:
- this builder
- Since:
- 1.0.0
-
allowInsecureLoopback
Sets whether plain HTTP is allowed for literal loopback tests.- Parameters:
value- the flag, or null to restore false- Returns:
- this builder
- Since:
- 1.0.0
-
acknowledgeUnpatchedRuntime
Sets explicit acknowledgment of runtime risk.- Parameters:
value- the flag, or null to restore false- Returns:
- this builder
- Since:
- 1.0.0
-
minimumTimeToLive
Sets the lowest discovery cache lifetime.- Parameters:
value- duration, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
defaultTimeToLive
Sets the fallback discovery cache lifetime.- Parameters:
value- duration, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
maximumTimeToLive
Sets the highest discovery cache lifetime.- Parameters:
value- duration, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
discoveryCooldown
Sets the discovery attempt window and initial failure backoff.- Parameters:
value- duration, or null to restore the default- Returns:
- this builder
- Since:
- 1.0.0
-
build
Validates issuer, explicit metadata and configuration without I/O or new threads.- Returns:
- the client
- Since:
- 1.0.0
-