Record Class AuthAccount

java.lang.Object
java.lang.Record
com.cloudforge.core.manager.auth.AuthAccount

public record AuthAccount(String id, String username, String email, String displayName, String role, String authSource, Boolean enabled, String status, String linkedAccountId, String temporaryPassword, Instant firstSeenAt, Instant lastSeenAt, Instant lastLoginAt, Integer activeSessionCount) extends Record
A CloudForge Manager user-directory account, as seen through AuthBackend — a typed stand-in for what used to be an ad-hoc Map<String,Object> built by hand in two different shapes (one for local rows, one for Cognito pool users). Several fields are only meaningful for one backend and null for the other, rather than every implementation needing to invent a value for a concept it doesn't have:
  • enabled/status — Cognito-only (account enable state / Cognito's UserStatus, e.g. "CONFIRMED"); always null for local accounts.
  • firstSeenAt/lastSeenAt/lastLoginAt — local-only; always null for Cognito accounts (Manager keeps no local row for the timestamps themselves). activeSessionCount is populated for both backends — a Cognito-authenticated login still gets a real Manager-tracked session (see CognitoAuthBackend's own javadoc), so it's null only when a backend genuinely can't determine it, not by backend type.
  • linkedAccountId — the counterpart account's id() in the *other* backend, when this account was created by (or has since been linked during) a migration; null otherwise. See AuthBackendMigrationService for how this avoids creating duplicate accounts on a later re-migration.
  • temporaryPassword — only ever populated on the AuthAccount an AuthBackend#createAccount call returns, never on one from listAccounts(); a generated credential is shown exactly once.
  • Constructor Details

    • AuthAccount

      public AuthAccount(String id, String username, String email, String displayName, String role, String authSource, Boolean enabled, String status, String linkedAccountId, String temporaryPassword, Instant firstSeenAt, Instant lastSeenAt, Instant lastLoginAt, Integer activeSessionCount)
      Creates an instance of a AuthAccount record class.
      Parameters:
      id - the value for the id record component
      username - the value for the username record component
      email - the value for the email record component
      displayName - the value for the displayName record component
      role - the value for the role record component
      authSource - the value for the authSource record component
      enabled - the value for the enabled record component
      status - the value for the status record component
      linkedAccountId - the value for the linkedAccountId record component
      temporaryPassword - the value for the temporaryPassword record component
      firstSeenAt - the value for the firstSeenAt record component
      lastSeenAt - the value for the lastSeenAt record component
      lastLoginAt - the value for the lastLoginAt record component
      activeSessionCount - the value for the activeSessionCount record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • username

      public String username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • email

      public String email()
      Returns the value of the email record component.
      Returns:
      the value of the email record component
    • displayName

      public String displayName()
      Returns the value of the displayName record component.
      Returns:
      the value of the displayName record component
    • role

      public String role()
      Returns the value of the role record component.
      Returns:
      the value of the role record component
    • authSource

      public String authSource()
      Returns the value of the authSource record component.
      Returns:
      the value of the authSource record component
    • enabled

      public Boolean enabled()
      Returns the value of the enabled record component.
      Returns:
      the value of the enabled record component
    • status

      public String status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • linkedAccountId

      public String linkedAccountId()
      Returns the value of the linkedAccountId record component.
      Returns:
      the value of the linkedAccountId record component
    • temporaryPassword

      public String temporaryPassword()
      Returns the value of the temporaryPassword record component.
      Returns:
      the value of the temporaryPassword record component
    • firstSeenAt

      public Instant firstSeenAt()
      Returns the value of the firstSeenAt record component.
      Returns:
      the value of the firstSeenAt record component
    • lastSeenAt

      public Instant lastSeenAt()
      Returns the value of the lastSeenAt record component.
      Returns:
      the value of the lastSeenAt record component
    • lastLoginAt

      public Instant lastLoginAt()
      Returns the value of the lastLoginAt record component.
      Returns:
      the value of the lastLoginAt record component
    • activeSessionCount

      public Integer activeSessionCount()
      Returns the value of the activeSessionCount record component.
      Returns:
      the value of the activeSessionCount record component