Class PutUserRequest
java.lang.Object
org.elasticsearch.client.security.PutUserRequest
- All Implemented Interfaces:
Validatable,org.elasticsearch.xcontent.ToXContent,org.elasticsearch.xcontent.ToXContentObject
public final class PutUserRequest
extends Object
implements Validatable, org.elasticsearch.xcontent.ToXContentObject
Request object to create or update a user in the native realm.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params -
Field Summary
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMSFields inherited from interface org.elasticsearch.client.Validatable
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionPutUserRequest(User user, char[] password, boolean enabled, RefreshPolicy refreshPolicy) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionbooleanchar[]getUser()inthashCode()booleanorg.elasticsearch.xcontent.XContentBuildertoXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) static PutUserRequestupdateUser(User user, boolean enabled, RefreshPolicy refreshPolicy) Update an existing user in the native realm without modifying their password.validate()Perform validation.static PutUserRequestwithPassword(User user, char[] password, boolean enabled, RefreshPolicy refreshPolicy) Create or update a user in the native realm, with the user's new or updated password specified in plaintext.static PutUserRequestwithPasswordHash(User user, char[] passwordHash, boolean enabled, RefreshPolicy refreshPolicy) Create or update a user in the native realm, with the user's new or updated password specified as a cryptographic hash.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
Constructor Details
-
PutUserRequest
@Deprecated public PutUserRequest(User user, @Nullable char[] password, boolean enabled, @Nullable RefreshPolicy refreshPolicy) Deprecated.Creates a new request that is used to create or update a user in the native realm.- Parameters:
user- the user to be created or updatedpassword- the password of the user. The password array is not modified by this class. It is the responsibility of the caller to clear the password after receiving a response.enabled- true if the user is enabled and allowed to access elasticsearchrefreshPolicy- the refresh policy for the request.
-
-
Method Details
-
withPassword
public static PutUserRequest withPassword(User user, char[] password, boolean enabled, RefreshPolicy refreshPolicy) Create or update a user in the native realm, with the user's new or updated password specified in plaintext.- Parameters:
user- the user to be created or updatedpassword- the password of the user. The password array is not modified by this class. It is the responsibility of the caller to clear the password after receiving a response.enabled- true if the user is enabled and allowed to access elasticsearchrefreshPolicy- the refresh policy for the request.
-
withPasswordHash
public static PutUserRequest withPasswordHash(User user, char[] passwordHash, boolean enabled, RefreshPolicy refreshPolicy) Create or update a user in the native realm, with the user's new or updated password specified as a cryptographic hash.- Parameters:
user- the user to be created or updatedpasswordHash- the hash of the password of the user. It must be in the correct format for the password hashing algorithm in use on this elasticsearch cluster. The array is not modified by this class. It is the responsibility of the caller to clear the hash after receiving a response.enabled- true if the user is enabled and allowed to access elasticsearchrefreshPolicy- the refresh policy for the request.
-
updateUser
Update an existing user in the native realm without modifying their password.- Parameters:
user- the user to be created or updatedenabled- true if the user is enabled and allowed to access elasticsearchrefreshPolicy- the refresh policy for the request.
-
getUser
-
getPassword
@Nullable public char[] getPassword() -
isEnabled
public boolean isEnabled() -
getRefreshPolicy
-
equals
-
hashCode
public int hashCode() -
validate
Description copied from interface:ValidatablePerform validation. This method does not have to be overridden in the event that no validation needs to be done, or the validation was done during object construction time. AValidationExceptionthat is not null is assumed to contain validation errors and will be thrown.- Specified by:
validatein interfaceValidatable- Returns:
- An
OptionalValidationExceptionthat contains a list of validation errors.
-
toXContent
public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.elasticsearch.xcontent.ToXContent- Throws:
IOException
-
withPassword(User, char[], boolean, RefreshPolicy)orupdateUser(User, boolean, RefreshPolicy)instead.