Record Class SessionInfo
java.lang.Object
java.lang.Record
co.ankatech.ankasecure.keymanagement.model.SessionInfo
- Record Components:
subject- the tokensubclaim (the authenticated principal), ornullclientId- the tokenclient_idclaim, ornullexpiresAt- the tokenexpclaim as anInstant, ornullwhen absentscopes- the tokenscopesclaim (nevernull; empty when absent)
public record SessionInfo(String subject, String clientId, Instant expiresAt, List<String> scopes)
extends Record
A log-safe summary of the bound session, derived by parsing the JWT claims locally (via
Nimbus) — no dedicated server endpoint is involved. This record NEVER contains the bearer token
itself: only the principal, its expiry, and its granted scopes.
The subject, client id and scopes are claims of the token the server issued, unrendered, for
programmatic use: a caller that displays one renders it through TerminalSafe.text(String).
toString() does.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclientId()Returns the value of theclientIdrecord component.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.scopes()Returns the value of thescopesrecord component.subject()Returns the value of thesubjectrecord component.toString()The summary as a log line, every claim rendered byTerminalSafe.text(String).
-
Constructor Details
-
SessionInfo
Canonical constructor; defensively copiesscopesand never storesnullfor it.
-
-
Method Details
-
toString
The summary as a log line, every claim rendered byTerminalSafe.text(String). -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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). -
subject
Returns the value of thesubjectrecord component.- Returns:
- the value of the
subjectrecord component
-
clientId
Returns the value of theclientIdrecord component.- Returns:
- the value of the
clientIdrecord component
-
expiresAt
Returns the value of theexpiresAtrecord component.- Returns:
- the value of the
expiresAtrecord component
-
scopes
Returns the value of thescopesrecord component.- Returns:
- the value of the
scopesrecord component
-