Class OidcClient
java.lang.Object
io.fluxzero.idp.client.OidcClient
Small OIDC client for authorization-code-with-PKCE application flows.
This client deliberately stops at protocol mechanics: building the authorization URL, exchanging a code for tokens and constructing a logout URL. It does not create application sessions, write cookies or map users. Fluxzero applications should keep that BFF responsibility in their own backend code so domain-specific user provisioning and roles stay close to the customer model.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRaw token response returned by an OIDC tenant. -
Constructor Summary
ConstructorsConstructorDescriptionOidcClient(OidcTenantConfig config) Creates a client that discovers OIDC endpoints from the configured issuer.OidcClient(OidcTenantConfig config, OidcDiscoveryDocument discovery) Creates a client with already discovered metadata. -
Method Summary
Modifier and TypeMethodDescriptionauthorizationUrl(OidcLoginState loginState) Builds the authorization endpoint URL from a stateless login transaction.authorizationUrl(Pkce pkce, String state) Builds the authorization endpoint URL for authorization-code flow with PKCE S256.config()endSessionUrl(String postLogoutRedirectUri) Builds a tenant logout URL when the issuer advertises one.endSessionUrl(String postLogoutRedirectUri, String idTokenHint) Builds a tenant logout URL with an optional ID token hint.exchangeCode(String code, String codeVerifier) Exchanges an authorization code for ID and access tokens.
-
Constructor Details
-
OidcClient
Creates a client that discovers OIDC endpoints from the configured issuer.- Parameters:
config- tenant configuration for this application
-
OidcClient
Creates a client with already discovered metadata.This constructor is useful for tests that want deterministic metadata without making a discovery HTTP request.
- Parameters:
config- tenant configuration for this applicationdiscovery- resolved OIDC discovery document
-
-
Method Details
-
authorizationUrl
Builds the authorization endpoint URL for authorization-code flow with PKCE S256.- Parameters:
pkce- verifier/challenge pair for this login attemptstate- CSRF correlation value stored by the application- Returns:
- redirect URL for the user's browser
-
authorizationUrl
Builds the authorization endpoint URL from a stateless login transaction.- Parameters:
loginState- BFF login transaction with state and PKCE verifier- Returns:
- redirect URL for the user's browser
-
exchangeCode
Exchanges an authorization code for ID and access tokens.- Parameters:
code- authorization code received on the application callbackcodeVerifier- PKCE verifier stored with the pending login- Returns:
- token response from the tenant
-
endSessionUrl
-
endSessionUrl
Builds a tenant logout URL with an optional ID token hint.- Parameters:
postLogoutRedirectUri- application URL to return to after logoutidTokenHint- ID token for the session being closed- Returns:
- logout URL or the redirect URI when no logout endpoint is advertised
-
config
-
discovery
-