|
@@ -237,12 +237,29 @@ public final class SecurityClient {
|
|
|
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @return the response from the enable user call
|
|
|
* @throws IOException in case there is a problem sending the request or parsing back the response
|
|
|
+ * @deprecated use {@link #enableUser(RequestOptions, EnableUserRequest)} instead
|
|
|
*/
|
|
|
+ @Deprecated
|
|
|
public EmptyResponse enableUser(EnableUserRequest request, RequestOptions options) throws IOException {
|
|
|
return restHighLevelClient.performRequestAndParseEntity(request, SecurityRequestConverters::enableUser, options,
|
|
|
EmptyResponse::fromXContent, emptySet());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Enable a native realm or built-in user synchronously.
|
|
|
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user.html">
|
|
|
+ * the docs</a> for more.
|
|
|
+ *
|
|
|
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
+ * @param request the request with the user to enable
|
|
|
+ * @return {@code true} if the request succeeded (the user is enabled)
|
|
|
+ * @throws IOException in case there is a problem sending the request or parsing back the response
|
|
|
+ */
|
|
|
+ public boolean enableUser(RequestOptions options, EnableUserRequest request) throws IOException {
|
|
|
+ return restHighLevelClient.performRequest(request, SecurityRequestConverters::enableUser, options,
|
|
|
+ RestHighLevelClient::convertExistsResponse, emptySet());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Enable a native realm or built-in user asynchronously.
|
|
|
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user.html">
|
|
@@ -251,13 +268,30 @@ public final class SecurityClient {
|
|
|
* @param request the request with the user to enable
|
|
|
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @param listener the listener to be notified upon request completion
|
|
|
+ * @deprecated use {@link #enableUserAsync(RequestOptions, EnableUserRequest, ActionListener)} instead
|
|
|
*/
|
|
|
+ @Deprecated
|
|
|
public void enableUserAsync(EnableUserRequest request, RequestOptions options,
|
|
|
ActionListener<EmptyResponse> listener) {
|
|
|
restHighLevelClient.performRequestAsyncAndParseEntity(request, SecurityRequestConverters::enableUser, options,
|
|
|
EmptyResponse::fromXContent, listener, emptySet());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Enable a native realm or built-in user asynchronously.
|
|
|
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user.html">
|
|
|
+ * the docs</a> for more.
|
|
|
+ *
|
|
|
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
+ * @param request the request with the user to enable
|
|
|
+ * @param listener the listener to be notified upon request completion
|
|
|
+ */
|
|
|
+ public void enableUserAsync(RequestOptions options, EnableUserRequest request,
|
|
|
+ ActionListener<Boolean> listener) {
|
|
|
+ restHighLevelClient.performRequestAsync(request, SecurityRequestConverters::enableUser, options,
|
|
|
+ RestHighLevelClient::convertExistsResponse, listener, emptySet());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Disable a native realm or built-in user synchronously.
|
|
|
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html">
|
|
@@ -267,12 +301,29 @@ public final class SecurityClient {
|
|
|
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @return the response from the enable user call
|
|
|
* @throws IOException in case there is a problem sending the request or parsing back the response
|
|
|
+ * @deprecated use {@link #disableUser(RequestOptions, DisableUserRequest)} instead
|
|
|
*/
|
|
|
+ @Deprecated
|
|
|
public EmptyResponse disableUser(DisableUserRequest request, RequestOptions options) throws IOException {
|
|
|
return restHighLevelClient.performRequestAndParseEntity(request, SecurityRequestConverters::disableUser, options,
|
|
|
EmptyResponse::fromXContent, emptySet());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Disable a native realm or built-in user synchronously.
|
|
|
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html">
|
|
|
+ * the docs</a> for more.
|
|
|
+ *
|
|
|
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
+ * @param request the request with the user to disable
|
|
|
+ * @return {@code true} if the request succeeded (the user is disabled)
|
|
|
+ * @throws IOException in case there is a problem sending the request or parsing back the response
|
|
|
+ */
|
|
|
+ public boolean disableUser(RequestOptions options, DisableUserRequest request) throws IOException {
|
|
|
+ return restHighLevelClient.performRequest(request, SecurityRequestConverters::disableUser, options,
|
|
|
+ RestHighLevelClient::convertExistsResponse, emptySet());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Disable a native realm or built-in user asynchronously.
|
|
|
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html">
|
|
@@ -281,13 +332,30 @@ public final class SecurityClient {
|
|
|
* @param request the request with the user to disable
|
|
|
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @param listener the listener to be notified upon request completion
|
|
|
+ * @deprecated use {@link #disableUserAsync(RequestOptions, DisableUserRequest, ActionListener)} instead
|
|
|
*/
|
|
|
+ @Deprecated
|
|
|
public void disableUserAsync(DisableUserRequest request, RequestOptions options,
|
|
|
ActionListener<EmptyResponse> listener) {
|
|
|
restHighLevelClient.performRequestAsyncAndParseEntity(request, SecurityRequestConverters::disableUser, options,
|
|
|
EmptyResponse::fromXContent, listener, emptySet());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Disable a native realm or built-in user asynchronously.
|
|
|
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html">
|
|
|
+ * the docs</a> for more.
|
|
|
+ *
|
|
|
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
+ * @param request the request with the user to disable
|
|
|
+ * @param listener the listener to be notified upon request completion
|
|
|
+ */
|
|
|
+ public void disableUserAsync(RequestOptions options, DisableUserRequest request,
|
|
|
+ ActionListener<Boolean> listener) {
|
|
|
+ restHighLevelClient.performRequestAsync(request, SecurityRequestConverters::disableUser, options,
|
|
|
+ RestHighLevelClient::convertExistsResponse, listener, emptySet());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Authenticate the current user and return all the information about the authenticated user.
|
|
|
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html">
|
|
@@ -457,12 +525,29 @@ public final class SecurityClient {
|
|
|
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @return the response from the change user password call
|
|
|
* @throws IOException in case there is a problem sending the request or parsing back the response
|
|
|
+ * @deprecated use {@link #changePassword(RequestOptions, ChangePasswordRequest)} instead
|
|
|
*/
|
|
|
+ @Deprecated
|
|
|
public EmptyResponse changePassword(ChangePasswordRequest request, RequestOptions options) throws IOException {
|
|
|
return restHighLevelClient.performRequestAndParseEntity(request, SecurityRequestConverters::changePassword, options,
|
|
|
EmptyResponse::fromXContent, emptySet());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Change the password of a user of a native realm or built-in user synchronously.
|
|
|
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html">
|
|
|
+ * the docs</a> for more.
|
|
|
+ *
|
|
|
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
+ * @param request the request with the user's new password
|
|
|
+ * @return {@code true} if the request succeeded (the new password was set)
|
|
|
+ * @throws IOException in case there is a problem sending the request or parsing back the response
|
|
|
+ */
|
|
|
+ public boolean changePassword(RequestOptions options, ChangePasswordRequest request) throws IOException {
|
|
|
+ return restHighLevelClient.performRequest(request, SecurityRequestConverters::changePassword, options,
|
|
|
+ RestHighLevelClient::convertExistsResponse, emptySet());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Change the password of a user of a native realm or built-in user asynchronously.
|
|
|
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html">
|
|
@@ -471,13 +556,31 @@ public final class SecurityClient {
|
|
|
* @param request the request with the user's new password
|
|
|
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @param listener the listener to be notified upon request completion
|
|
|
+ * @deprecated use {@link #changePasswordAsync(RequestOptions, ChangePasswordRequest, ActionListener)} instead
|
|
|
*/
|
|
|
+ @Deprecated
|
|
|
public void changePasswordAsync(ChangePasswordRequest request, RequestOptions options,
|
|
|
ActionListener<EmptyResponse> listener) {
|
|
|
restHighLevelClient.performRequestAsyncAndParseEntity(request, SecurityRequestConverters::changePassword, options,
|
|
|
EmptyResponse::fromXContent, listener, emptySet());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Change the password of a user of a native realm or built-in user asynchronously.
|
|
|
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html">
|
|
|
+ * the docs</a> for more.
|
|
|
+ *
|
|
|
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
+ * @param request the request with the user's new password
|
|
|
+ * @param listener the listener to be notified upon request completion
|
|
|
+ */
|
|
|
+ public void changePasswordAsync(RequestOptions options, ChangePasswordRequest request,
|
|
|
+ ActionListener<Boolean> listener) {
|
|
|
+ restHighLevelClient.performRequestAsync(request, SecurityRequestConverters::changePassword, options,
|
|
|
+ RestHighLevelClient::convertExistsResponse, listener, emptySet());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* Delete a role mapping.
|
|
|
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html">
|