Class User
java.lang.Object
org.elasticsearch.client.security.user.User
public final class User
extends java.lang.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 Summary
Constructors Constructor Description User(java.lang.String username, java.util.Collection<java.lang.String> roles)Builds the user to be utilized with security APIs.User(java.lang.String username, java.util.Collection<java.lang.String> roles, java.util.Map<java.lang.String,java.lang.Object> metadata, java.lang.String fullName, java.lang.String email)Builds the user to be utilized with security APIs. -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.StringgetEmail()java.lang.StringgetFullName()java.util.Map<java.lang.String,java.lang.Object>getMetadata()java.util.Set<java.lang.String>getRoles()java.lang.StringgetUsername()inthashCode()java.lang.StringtoString()
-
Constructor Details
-
User
public User(java.lang.String username, java.util.Collection<java.lang.String> roles, java.util.Map<java.lang.String,java.lang.Object> metadata, @Nullable java.lang.String fullName, @Nullable java.lang.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 realmroles- the roles that this user is assignedmetadata- a map of additional user attributes that may be used in templating rolesfullName- the full name of the user that may be used for display purposesemail- the email address of the user
-
User
public User(java.lang.String username, java.util.Collection<java.lang.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 realmroles- the roles that this user is assigned
-
-
Method Details
-
getUsername
public java.lang.String getUsername()- Returns:
- The principal of this user - effectively serving as the
unique identity of the user. Can never be
null.
-
getRoles
public java.util.Set<java.lang.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 java.util.Map<java.lang.String,java.lang.Object> getMetadata()- Returns:
- The metadata that is associated with this user. Can never be
null.
-
getFullName
@Nullable public java.lang.String getFullName()- Returns:
- The full name of this user. May be
null.
-
getEmail
@Nullable public java.lang.String getEmail()- Returns:
- The email of this user. May be
null.
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-