Record Class SessionInfo

java.lang.Object
java.lang.Record
co.ankatech.ankasecure.keymanagement.model.SessionInfo
Record Components:
subject - the token sub claim (the authenticated principal), or null
clientId - the token client_id claim, or null
expiresAt - the token exp claim as an Instant, or null when absent
scopes - the token scopes claim (never null; 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 Details

    • SessionInfo

      public SessionInfo(String subject, String clientId, Instant expiresAt, List<String> scopes)
      Canonical constructor; defensively copies scopes and never stores null for it.
  • Method Details

    • toString

      public String toString()
      The summary as a log line, every claim rendered by TerminalSafe.text(String).
      Specified by:
      toString in class Record
      Returns:
      the rendering
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • subject

      public String subject()
      Returns the value of the subject record component.
      Returns:
      the value of the subject record component
    • clientId

      public String clientId()
      Returns the value of the clientId record component.
      Returns:
      the value of the clientId record component
    • expiresAt

      public Instant expiresAt()
      Returns the value of the expiresAt record component.
      Returns:
      the value of the expiresAt record component
    • scopes

      public List<String> scopes()
      Returns the value of the scopes record component.
      Returns:
      the value of the scopes record component