Record Class OidcUser

java.lang.Object
java.lang.Record
io.fluxzero.sdk.tracking.handling.authentication.OidcUser
Record Components:
subject - stable subject identifier from the sub claim
email - optional email address
tenantId - optional Fluxzero tenant identifier from the tenant_id claim
displayName - optional display name from the name claim
roles - resolved roles and scopes; always includes authenticated
claims - raw userinfo claims
All Implemented Interfaces:
User, Principal

public record OidcUser(String subject, String email, String tenantId, String displayName, Set<String> roles, Map<String,Object> claims) extends Record implements User
Default User representation for identities resolved from an OIDC userinfo endpoint.
  • Constructor Details

    • OidcUser

      public OidcUser(String subject, String email, String tenantId, String displayName, Set<String> roles, Map<String,Object> claims)
      Creates an instance of a OidcUser record class.
      Parameters:
      subject - the value for the subject record component
      email - the value for the email record component
      tenantId - the value for the tenantId record component
      displayName - the value for the displayName record component
      roles - the value for the roles record component
      claims - the value for the claims record component
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface Principal
    • hasRole

      public boolean hasRole(String role)
      Description copied from interface: User
      Indicates whether this user has the specified role.
      Specified by:
      hasRole in interface User
      Parameters:
      role - a role string such as "admin" or "viewer"
      Returns:
      true if the user has the role, false otherwise
    • claim

      public Object claim(String name)
      Returns a raw claim by name, or null when the claim is absent.
    • 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 interface Principal
      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 interface Principal
      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 interface Principal
      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
    • email

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

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

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

      public Set<String> roles()
      Returns the value of the roles record component.
      Returns:
      the value of the roles record component
    • claims

      public Map<String,Object> claims()
      Returns the value of the claims record component.
      Returns:
      the value of the claims record component