Class SamlSessionReference

java.lang.Object
com.revetsec.saml.SamlSessionReference

@Immutable public final class SamlSessionReference extends Object
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 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 use fromSealedFormResult(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

      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. Prefer toSealedFormResult(StateSealer, String, Instant) to handle that expected outcome.
      Parameters:
      sealer - active and verification keys
      context - application-selected session context
      expiresAt - absolute seal expiry
      Returns:
      sealed storage form
      Throws:
      IllegalArgumentException - if an argument is invalid or the reference exceeds the configured seal limit
      IllegalStateException - if the cryptographic provider cannot seal
      Since:
      1.0.0
    • toSealedFormResult

      Seals logout continuity fields or reports a size limit or provider failure explicitly. Only SamlSessionReferenceSealResult.Succeeded contains 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 keys
      context - application-selected session context
      expiresAt - 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 null
      IllegalArgumentException - 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 form
      sealer - active and verification keys
      context - original application context
      clock - time source for expiry
      Returns:
      parsed logout continuity reference or a fixed sealed-state/structural rejection
      Since:
      1.0.0
    • toString

      Redacts the session identifiers.
      Overrides:
      toString in class Object
      Returns:
      redacted description
      Since:
      1.0.0