Record Class OidcLoginState
java.lang.Object
java.lang.Record
io.fluxzero.idp.client.OidcLoginState
- Record Components:
state- CSRF/correlation value sent to the authorization endpoint and checked on callbackcodeVerifier- PKCE verifier kept by the BFF until token exchangeredirectTo- safe application-local URL to return to after the callbackexpiresAt- expiry for this login attempt
public record OidcLoginState(String state, String codeVerifier, String redirectTo, Instant expiresAt)
extends Record
Stateless BFF login transaction data for one OIDC Authorization Code + PKCE attempt.
The application stores this data client-side in an encrypted, authenticated cookie using
OidcLoginStateCodec. That keeps callback handling independent from a specific BFF instance while preserving
the usual OIDC checks: callback state correlation, PKCE verifier retention and short-lived expiry.
-
Constructor Summary
ConstructorsConstructorDescriptionOidcLoginState(String state, String codeVerifier, String redirectTo, Instant expiresAt) Creates an instance of aOidcLoginStaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecodeVerifierrecord component.static OidcLoginStateCreates a new login state using the system clock.static OidcLoginStateCreates a new login state expiring after the supplied time-to-live.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexpiresAtrecord component.final inthashCode()Returns a hash code value for this object.booleanReturnstruewhen this login attempt is expired at the supplied time.booleanmatchesState(String callbackState) Returnstruewhen the callback state matches this login attempt.pkce()Returns the PKCE pair derived from the stored verifier.Returns the value of theredirectTorecord component.state()Returns the value of thestaterecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
OidcLoginState
Creates an instance of aOidcLoginStaterecord class.- Parameters:
state- the value for thestaterecord componentcodeVerifier- the value for thecodeVerifierrecord componentredirectTo- the value for theredirectTorecord componentexpiresAt- the value for theexpiresAtrecord component
-
-
Method Details
-
create
Creates a new login state expiring after the supplied time-to-live.- Parameters:
redirectTo- safe application-local URL to return to after logintimeToLive- maximum lifetime for this login attemptnow- current time- Returns:
- new login state with random state and PKCE verifier
-
create
Creates a new login state using the system clock. -
pkce
Returns the PKCE pair derived from the stored verifier. -
matchesState
Returnstruewhen the callback state matches this login attempt. -
isExpired
Returnstruewhen this login attempt is expired at the supplied time. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
state
-
codeVerifier
Returns the value of thecodeVerifierrecord component.- Returns:
- the value of the
codeVerifierrecord component
-
redirectTo
Returns the value of theredirectTorecord component.- Returns:
- the value of the
redirectTorecord component
-
expiresAt
-