java.lang.Object
org.elasticsearch.client.security.user.User

public final class User extends Object
A user to be utilized with security APIs. Can be an existing authenticated user or it can be a new user to be enrolled to the native realm.
  • Constructor Details

    • User

      public User(String username, Collection<String> roles, Map<String,Object> metadata, @Nullable String fullName, @Nullable String email)
      Builds the user to be utilized with security APIs.
      Parameters:
      username - the username, also known as the principal, unique for in the scope of a realm
      roles - the roles that this user is assigned
      metadata - a map of additional user attributes that may be used in templating roles
      fullName - the full name of the user that may be used for display purposes
      email - the email address of the user
    • User

      public User(String username, Collection<String> roles)
      Builds the user to be utilized with security APIs.
      Parameters:
      username - the username, also known as the principal, unique for in the scope of a realm
      roles - the roles that this user is assigned
  • Method Details

    • getUsername

      public String getUsername()
      Returns:
      The principal of this user - effectively serving as the unique identity of the user. Can never be null.
    • getRoles

      public Set<String> getRoles()
      Returns:
      The roles this user is associated with. The roles are identified by their unique names and each represents as set of permissions. Can never be null.
    • getMetadata

      public Map<String,Object> getMetadata()
      Returns:
      The metadata that is associated with this user. Can never be null.
    • getFullName

      @Nullable public String getFullName()
      Returns:
      The full name of this user. May be null.
    • getEmail

      @Nullable public String getEmail()
      Returns:
      The email of this user. May be null.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object