Record Class AuthenticationInfo

java.lang.Object
java.lang.Record
ai.mindconnect.common.AuthenticationInfo

public record AuthenticationInfo(String userId, Namespace namespace, List<String> roles) extends Record
Carries the authenticated user's identity and authorization context.

Server-internal domain object — derived at the transport boundary (e.g. by a Spring Security filter that converts an Authentication into this), then passed explicitly to ports and services. Never put on the wire and never set by clients; clients authenticate using standard transport mechanisms (Bearer tokens, OAuth).

  • Constructor Details

    • AuthenticationInfo

      public AuthenticationInfo(String userId, Namespace namespace, List<String> roles)
      Creates an instance of a AuthenticationInfo record class.
      Parameters:
      userId - the value for the userId record component
      namespace - the value for the namespace record component
      roles - the value for the roles record component
  • Method Details

    • of

      public static AuthenticationInfo of(String userId, Namespace namespace)
    • of

      public static AuthenticationInfo of(String userId, Namespace namespace, List<String> roles)
    • 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.
    • userId

      public String userId()
      Returns the value of the userId record component.
      Returns:
      the value of the userId record component
    • namespace

      public Namespace namespace()
      Returns the value of the namespace record component.
      Returns:
      the value of the namespace record component
    • roles

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