Record Class IamCurrentUser

java.lang.Object
java.lang.Record
com.chaosguide.iam.vertex.context.IamCurrentUser

public record IamCurrentUser(String subject, String applicationId, String email, boolean emailVerified, String username, String organizationId, String organizationSlug, String organizationRole, String workspaceId, String sessionId, Set<String> roles, Set<String> permissions, List<String> authenticationMethods, String authenticationContextClass, IamActor actor, Map<String,Object> claims) extends Record
Request-local authenticated user from verified JWT claims or an online validated server session, with authoritative Spring Security permissions.
  • Constructor Details

    • IamCurrentUser

      public IamCurrentUser(String subject, String applicationId, String email, boolean emailVerified, String username, String organizationId, String organizationSlug, String organizationRole, String workspaceId, String sessionId, Set<String> roles, Set<String> permissions, List<String> authenticationMethods, String authenticationContextClass, IamActor actor, Map<String,Object> claims)
      Creates an instance of a IamCurrentUser record class.
      Parameters:
      subject - the value for the subject record component
      applicationId - the value for the applicationId record component
      email - the value for the email record component
      emailVerified - the value for the emailVerified record component
      username - the value for the username record component
      organizationId - the value for the organizationId record component
      organizationSlug - the value for the organizationSlug record component
      organizationRole - the value for the organizationRole record component
      workspaceId - the value for the workspaceId record component
      sessionId - the value for the sessionId record component
      roles - the value for the roles record component
      permissions - the value for the permissions record component
      authenticationMethods - the value for the authenticationMethods record component
      authenticationContextClass - the value for the authenticationContextClass record component
      actor - the value for the actor record component
      claims - the value for the claims record component
  • Method Details

    • userId

      public String userId()
      Alias for applications that call the actor id userId.
    • isImpersonating

      public boolean isImpersonating()
    • hasMfa

      public boolean hasMfa()
    • hasPermission

      public boolean hasPermission(PermissionKey permission)
    • hasPermission

      public boolean hasPermission(String resource, String action)
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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
    • applicationId

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

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

      public boolean emailVerified()
      Returns the value of the emailVerified record component.
      Returns:
      the value of the emailVerified record component
    • username

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

      public String organizationId()
      Returns the value of the organizationId record component.
      Returns:
      the value of the organizationId record component
    • organizationSlug

      public String organizationSlug()
      Returns the value of the organizationSlug record component.
      Returns:
      the value of the organizationSlug record component
    • organizationRole

      public String organizationRole()
      Returns the value of the organizationRole record component.
      Returns:
      the value of the organizationRole record component
    • workspaceId

      public String workspaceId()
      Returns the value of the workspaceId record component.
      Returns:
      the value of the workspaceId record component
    • sessionId

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

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

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

      public List<String> authenticationMethods()
      Returns the value of the authenticationMethods record component.
      Returns:
      the value of the authenticationMethods record component
    • authenticationContextClass

      public String authenticationContextClass()
      Returns the value of the authenticationContextClass record component.
      Returns:
      the value of the authenticationContextClass record component
    • actor

      public IamActor actor()
      Returns the value of the actor record component.
      Returns:
      the value of the actor record component
    • claims

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