Class SamlSessionReference
java.lang.Object
com.revetsec.saml.SamlSessionReference
Identity and session fields from a checked assertion for later front-channel logout matching.
The application stores this reference alongside its own application session.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionfromSealedFormResult(@NonNull String sealedForm, @NonNull StateSealer sealer, @NonNull String context, @NonNull Clock clock) Opens a SAML session reference under the same application context.fromSerializedFormResult(@NonNull String serializedForm) Restores a bounded reference from trusted application storage.Returns the application-defined IdP namespace.Returns the checked IdP entity ID.Returns the checked NameID and qualifiers used for logout matching.Returns the session index when the IdP supplied one.Returns the IdP's session expiry when supplied.toSealedForm(@NonNull StateSealer sealer, @NonNull String context, @NonNull Instant expiresAt) Seals the reference under a SAML-specific type and application context.toSealedFormResult(@NonNull StateSealer sealer, @NonNull String context, @NonNull Instant expiresAt) Seals logout continuity fields or reports a size limit or provider failure explicitly.Serializes the checked logout continuity fields for trusted application storage.toString()Redacts the session identifiers.
-
Method Details
-
getIdentityProviderConnectionId
Returns the application-defined IdP namespace.- Returns:
- connection ID
- Since:
- 1.0.0
-
getIdentityProviderEntityId
Returns the checked IdP entity ID.- Returns:
- entity ID
- Since:
- 1.0.0
-
getNameId
Returns the checked NameID and qualifiers used for logout matching.- Returns:
- NameID
- Since:
- 1.0.0
-
getSessionIndex
Returns the session index when the IdP supplied one.- Returns:
- optional session index
- Since:
- 1.0.0
-
getSessionNotOnOrAfter
Returns the IdP's session expiry when supplied.- Returns:
- optional expiry
- Since:
- 1.0.0
-
toSerializedForm
Serializes the checked logout continuity fields for trusted application storage. This contains personal data and is not itself proof of identity or authenticity. The version-1 form uses at most 66,631 ASCII characters, including base64url expansion of well-formed fields at their existing validation limits. This storage budget is separate from a sealer's configured limit and from browser cookie limits.- Returns:
- bounded versioned storage form
- Since:
- 1.0.0
-
fromSerializedFormResult
@CheckReturnValue public static @NonNull SamlSessionReferenceParseResult fromSerializedFormResult(@NonNull String serializedForm) Restores a bounded reference from trusted application storage. It validates structure, but cannot authenticate the original SAML assertion. Browser-side storage must usefromSealedFormResult(String, StateSealer, String, Clock).- Parameters:
serializedForm- versioned storage form- Returns:
- parsed logout continuity reference or a fixed structural rejection, never authenticated identity
- Since:
- 1.0.0
-
toSealedForm
public @NonNull String toSealedForm(@NonNull StateSealer sealer, @NonNull String context, @NonNull Instant expiresAt) Seals the reference under a SAML-specific type and application context. The application chooses an expiry no later than its own session lifetime. A valid reference can exceed even the largest allowed seal. PrefertoSealedFormResult(StateSealer, String, Instant)to handle that expected outcome.- Parameters:
sealer- active and verification keyscontext- application-selected session contextexpiresAt- absolute seal expiry- Returns:
- sealed storage form
- Throws:
IllegalArgumentException- if an argument is invalid or the reference exceeds the configured seal limitIllegalStateException- if the cryptographic provider cannot seal- Since:
- 1.0.0
-
toSealedFormResult
@CheckReturnValue public @NonNull SamlSessionReferenceSealResult toSealedFormResult(@NonNull StateSealer sealer, @NonNull String context, @NonNull Instant expiresAt) Seals logout continuity fields or reports a size limit or provider failure explicitly. OnlySamlSessionReferenceSealResult.Succeededcontains a sealed value. A valid reference need not fit a seal: use trusted server-side storage when it is too large, without truncating identifiers or weakening the sealer's configured bound. Size refusal performs no random draws or encryption. Null and invalid arguments remain programmer errors, including an invalid context even when the reference is too large.- Parameters:
sealer- active and verification keyscontext- application-selected session contextexpiresAt- absolute seal expiry, no later than the application's session lifetime- Returns:
- a sealed value, an expected size refusal, or an unavailable cryptographic provider
- Throws:
NullPointerException- if a required argument is nullIllegalArgumentException- if the context or reference text is invalid- Since:
- 1.0.0
-
fromSealedFormResult
@CheckReturnValue public static @NonNull SamlSessionReferenceParseResult fromSealedFormResult(@NonNull String sealedForm, @NonNull StateSealer sealer, @NonNull String context, @NonNull Clock clock) Opens a SAML session reference under the same application context. Opening does not create or authenticate an identity.- Parameters:
sealedForm- sealed storage formsealer- active and verification keyscontext- original application contextclock- time source for expiry- Returns:
- parsed logout continuity reference or a fixed sealed-state/structural rejection
- Since:
- 1.0.0
-
toString
-