Class SecurityClient

    • Method Detail

      • getUsers

        public GetUsersResponse getUsers​(GetUsersRequest request,
                                         RequestOptions options)
                                  throws java.io.IOException
        Get a user, or list of users, in the native realm synchronously. See the docs for more information.
        Parameters:
        request - the request with the user's name
        options - the request options (e.g., headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the get users call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • getUsersAsync

        public Cancellable getUsersAsync​(GetUsersRequest request,
                                         RequestOptions options,
                                         ActionListener<GetUsersResponse> listener)
        Get a user, or list of users, in the native realm asynchronously. See the docs for more information.
        Parameters:
        request - the request with the user's name
        options - the request options (e.g., headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • putUser

        public PutUserResponse putUser​(PutUserRequest request,
                                       RequestOptions options)
                                throws java.io.IOException
        Create/update a user in the native realm synchronously. See the docs for more.
        Parameters:
        request - the request with the user's information
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the put user call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • putUserAsync

        public Cancellable putUserAsync​(PutUserRequest request,
                                        RequestOptions options,
                                        ActionListener<PutUserResponse> listener)
        Asynchronously create/update a user in the native realm. See the docs for more.
        Parameters:
        request - the request with the user's information
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • deleteUser

        public DeleteUserResponse deleteUser​(DeleteUserRequest request,
                                             RequestOptions options)
                                      throws java.io.IOException
        Removes user from the native realm synchronously. See the docs for more.
        Parameters:
        request - the request with the user to delete
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the delete user call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • putRoleMapping

        public PutRoleMappingResponse putRoleMapping​(PutRoleMappingRequest request,
                                                     RequestOptions options)
                                              throws java.io.IOException
        Create/Update a role mapping. See the docs for more.
        Parameters:
        request - the request with the role mapping information
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the put role mapping call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • getRoleMappings

        public GetRoleMappingsResponse getRoleMappings​(GetRoleMappingsRequest request,
                                                       RequestOptions options)
                                                throws java.io.IOException
        Synchronously get role mapping(s). See the docs for more.
        Parameters:
        request - GetRoleMappingsRequest with role mapping name(s). If no role mapping name is provided then retrieves all role mappings.
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the get role mapping call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • enableUser

        public boolean enableUser​(EnableUserRequest request,
                                  RequestOptions options)
                           throws java.io.IOException
        Enable a native realm or built-in user synchronously. See the docs for more.
        Parameters:
        request - the request with the user to enable
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        true if the request succeeded (the user is enabled)
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • enableUser

        @Deprecated
        public boolean enableUser​(RequestOptions options,
                                  EnableUserRequest request)
                           throws java.io.IOException
        Enable a native realm or built-in user synchronously. See the docs for more.
        Parameters:
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        request - the request with the user to enable
        Returns:
        true if the request succeeded (the user is enabled)
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • enableUserAsync

        public Cancellable enableUserAsync​(EnableUserRequest request,
                                           RequestOptions options,
                                           ActionListener<java.lang.Boolean> listener)
        Enable a native realm or built-in user asynchronously. See the docs for more.
        Parameters:
        request - the request with the user to enable
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • disableUser

        public boolean disableUser​(DisableUserRequest request,
                                   RequestOptions options)
                            throws java.io.IOException
        Disable a native realm or built-in user synchronously. See the docs for more.
        Parameters:
        request - the request with the user to disable
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        true if the request succeeded (the user is disabled)
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • disableUser

        @Deprecated
        public boolean disableUser​(RequestOptions options,
                                   DisableUserRequest request)
                            throws java.io.IOException
        Disable a native realm or built-in user synchronously. See the docs for more.
        Parameters:
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        request - the request with the user to disable
        Returns:
        true if the request succeeded (the user is disabled)
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • disableUserAsync

        public Cancellable disableUserAsync​(DisableUserRequest request,
                                            RequestOptions options,
                                            ActionListener<java.lang.Boolean> listener)
        Disable a native realm or built-in user asynchronously. See the docs for more.
        Parameters:
        request - the request with the user to disable
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • authenticate

        public AuthenticateResponse authenticate​(RequestOptions options)
                                          throws java.io.IOException
        Authenticate the current user and return all the information about the authenticated user. See the docs for more.
        Parameters:
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the responsee from the authenticate user call
        Throws:
        java.io.IOException
      • authenticateAsync

        public Cancellable authenticateAsync​(RequestOptions options,
                                             ActionListener<AuthenticateResponse> listener)
        Authenticate the current user asynchronously and return all the information about the authenticated user. See the docs for more.
        Parameters:
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • hasPrivileges

        public HasPrivilegesResponse hasPrivileges​(HasPrivilegesRequest request,
                                                   RequestOptions options)
                                            throws java.io.IOException
        Determine whether the current user has a specified list of privileges See the docs for more.
        Parameters:
        request - the request with the privileges to check
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the has privileges call
        Throws:
        java.io.IOException
      • hasPrivilegesAsync

        public Cancellable hasPrivilegesAsync​(HasPrivilegesRequest request,
                                              RequestOptions options,
                                              ActionListener<HasPrivilegesResponse> listener)
        Asynchronously determine whether the current user has a specified list of privileges See the docs for more.
        Parameters:
        request - the request with the privileges to check
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • getUserPrivileges

        public GetUserPrivilegesResponse getUserPrivileges​(RequestOptions options)
                                                    throws java.io.IOException
        Retrieve the set of effective privileges held by the current user.
        Parameters:
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Throws:
        java.io.IOException
      • getUserPrivilegesAsync

        public Cancellable getUserPrivilegesAsync​(RequestOptions options,
                                                  ActionListener<GetUserPrivilegesResponse> listener)
        Asynchronously retrieve the set of effective privileges held by the current user.
        Parameters:
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • clearRealmCache

        public ClearRealmCacheResponse clearRealmCache​(ClearRealmCacheRequest request,
                                                       RequestOptions options)
                                                throws java.io.IOException
        Clears the cache in one or more realms. See the docs for more.
        Parameters:
        request - the request with the realm names and usernames to clear the cache for
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the clear realm cache call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • clearRealmCacheAsync

        public Cancellable clearRealmCacheAsync​(ClearRealmCacheRequest request,
                                                RequestOptions options,
                                                ActionListener<ClearRealmCacheResponse> listener)
        Clears the cache in one or more realms asynchronously. See the docs for more.
        Parameters:
        request - the request with the realm names and usernames to clear the cache for
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • clearRolesCache

        public ClearRolesCacheResponse clearRolesCache​(ClearRolesCacheRequest request,
                                                       RequestOptions options)
                                                throws java.io.IOException
        Clears the roles cache for a set of roles. See the docs for more.
        Parameters:
        request - the request with the roles for which the cache should be cleared.
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the clear roles cache call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • clearRolesCacheAsync

        public Cancellable clearRolesCacheAsync​(ClearRolesCacheRequest request,
                                                RequestOptions options,
                                                ActionListener<ClearRolesCacheResponse> listener)
        Clears the roles cache for a set of roles asynchronously. See the docs for more.
        Parameters:
        request - the request with the roles for which the cache should be cleared.
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • getSslCertificates

        public GetSslCertificatesResponse getSslCertificates​(RequestOptions options)
                                                      throws java.io.IOException
        Synchronously retrieve the X.509 certificates that are used to encrypt communications in an Elasticsearch cluster. See the docs for more.
        Parameters:
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the get certificates call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • getSslCertificatesAsync

        public Cancellable getSslCertificatesAsync​(RequestOptions options,
                                                   ActionListener<GetSslCertificatesResponse> listener)
        Asynchronously retrieve the X.509 certificates that are used to encrypt communications in an Elasticsearch cluster. See the docs for more.
        Parameters:
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • changePassword

        public boolean changePassword​(ChangePasswordRequest request,
                                      RequestOptions options)
                               throws java.io.IOException
        Change the password of a user of a native realm or built-in user synchronously. See the docs for more.
        Parameters:
        request - the request with the user's new password
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        true if the request succeeded (the new password was set)
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • changePassword

        @Deprecated
        public boolean changePassword​(RequestOptions options,
                                      ChangePasswordRequest request)
                               throws java.io.IOException
        Change the password of a user of a native realm or built-in user synchronously. See the docs for more.
        Parameters:
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        request - the request with the user's new password
        Returns:
        true if the request succeeded (the new password was set)
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • changePasswordAsync

        public Cancellable changePasswordAsync​(ChangePasswordRequest request,
                                               RequestOptions options,
                                               ActionListener<java.lang.Boolean> listener)
        Change the password of a user of a native realm or built-in user asynchronously. See the docs for more.
        Parameters:
        request - the request with the user's new password
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • deleteRoleMapping

        public DeleteRoleMappingResponse deleteRoleMapping​(DeleteRoleMappingRequest request,
                                                           RequestOptions options)
                                                    throws java.io.IOException
        Delete a role mapping. See the docs for more.
        Parameters:
        request - the request with the role mapping name to be deleted.
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the delete role mapping call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • getRolesAsync

        public Cancellable getRolesAsync​(GetRolesRequest request,
                                         RequestOptions options,
                                         ActionListener<GetRolesResponse> listener)
        Asynchronously retrieves roles from the native roles store. See the docs for more.
        Parameters:
        request - the request with the roles to get
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • getRoles

        public GetRolesResponse getRoles​(GetRolesRequest request,
                                         RequestOptions options)
                                  throws java.io.IOException
        Retrieves roles from the native roles store. See the docs for more.
        Parameters:
        request - the request with the roles to get
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the get roles call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • putRoleAsync

        public Cancellable putRoleAsync​(PutRoleRequest request,
                                        RequestOptions options,
                                        ActionListener<PutRoleResponse> listener)
        Asynchronously creates or updates a role in the native roles store. See the docs for more.
        Parameters:
        request - the request containing the role to create or update
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • putRole

        public PutRoleResponse putRole​(PutRoleRequest request,
                                       RequestOptions options)
                                throws java.io.IOException
        Create or update a role in the native roles store. See the docs for more.
        Parameters:
        request - the request containing the role to create or update
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the put role call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • deleteRole

        public DeleteRoleResponse deleteRole​(DeleteRoleRequest request,
                                             RequestOptions options)
                                      throws java.io.IOException
        Removes role from the native realm. See the docs for more.
        Parameters:
        request - the request with the role to delete
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the delete role call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • createToken

        public CreateTokenResponse createToken​(CreateTokenRequest request,
                                               RequestOptions options)
                                        throws java.io.IOException
        Creates an OAuth2 token. See the docs for more.
        Parameters:
        request - the request for the token
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the create token call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • invalidateToken

        public InvalidateTokenResponse invalidateToken​(InvalidateTokenRequest request,
                                                       RequestOptions options)
                                                throws java.io.IOException
        Invalidates an OAuth2 token. See the docs for more.
        Parameters:
        request - the request to invalidate the token
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the create token call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • getBuiltinPrivileges

        public GetBuiltinPrivilegesResponse getBuiltinPrivileges​(RequestOptions options)
                                                          throws java.io.IOException
        Synchronously get builtin (cluster & index) privilege(s). See the docs for more.
        Parameters:
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the get builtin privileges call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • getPrivileges

        public GetPrivilegesResponse getPrivileges​(GetPrivilegesRequest request,
                                                   RequestOptions options)
                                            throws java.io.IOException
        Synchronously get application privilege(s). See the docs for more.
        Parameters:
        request - GetPrivilegesRequest with the application name and the privilege name. If no application name is provided, information about all privileges for all applications is retrieved. If no privilege name is provided, information about all privileges of the specified application is retrieved.
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the get privileges call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • getPrivilegesAsync

        public Cancellable getPrivilegesAsync​(GetPrivilegesRequest request,
                                              RequestOptions options,
                                              ActionListener<GetPrivilegesResponse> listener)
        Asynchronously get application privilege(s). See the docs for more.
        Parameters:
        request - GetPrivilegesRequest with the application name and the privilege name. If no application name is provided, information about all privileges for all applications is retrieved. If no privilege name is provided, information about all privileges of the specified application is retrieved.
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion
        Returns:
        cancellable that may be used to cancel the request
      • putPrivileges

        public PutPrivilegesResponse putPrivileges​(PutPrivilegesRequest request,
                                                   RequestOptions options)
                                            throws java.io.IOException
        Create or update application privileges. See the docs for more.
        Parameters:
        request - the request to create or update application privileges
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the create or update application privileges call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • deletePrivileges

        public DeletePrivilegesResponse deletePrivileges​(DeletePrivilegesRequest request,
                                                         RequestOptions options)
                                                  throws java.io.IOException
        Removes application privilege(s) See the docs for more.
        Parameters:
        request - the request with the application privilege to delete
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the delete application privilege call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • createApiKey

        public CreateApiKeyResponse createApiKey​(CreateApiKeyRequest request,
                                                 RequestOptions options)
                                          throws java.io.IOException
        Create an API Key.
        See the docs for more.
        Parameters:
        request - the request to create a API key
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the create API key call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • getApiKey

        public GetApiKeyResponse getApiKey​(GetApiKeyRequest request,
                                           RequestOptions options)
                                    throws java.io.IOException
        Retrieve API Key(s) information.
        See the docs for more.
        Parameters:
        request - the request to retrieve API key(s)
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the create API key call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • invalidateApiKey

        public InvalidateApiKeyResponse invalidateApiKey​(InvalidateApiKeyRequest request,
                                                         RequestOptions options)
                                                  throws java.io.IOException
        Invalidate API Key(s).
        See the docs for more.
        Parameters:
        request - the request to invalidate API key(s)
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the invalidate API key call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • delegatePkiAuthentication

        public DelegatePkiAuthenticationResponse delegatePkiAuthentication​(DelegatePkiAuthenticationRequest request,
                                                                           RequestOptions options)
                                                                    throws java.io.IOException
        Get an Elasticsearch access token from an X509Certificate chain. The certificate chain is that of the client from a mutually authenticated TLS session, and it is validated by the PKI realms with delegation.enabled toggled to true.
        See the docs for more details.
        Parameters:
        request - the request containing the certificate chain
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        Returns:
        the response from the delegate-pki-authentication API key call
        Throws:
        java.io.IOException - in case there is a problem sending the request or parsing back the response
      • delegatePkiAuthenticationAsync

        public Cancellable delegatePkiAuthenticationAsync​(DelegatePkiAuthenticationRequest request,
                                                          RequestOptions options,
                                                          ActionListener<DelegatePkiAuthenticationResponse> listener)
        Asynchronously get an Elasticsearch access token from an X509Certificate chain. The certificate chain is that of the client from a mutually authenticated TLS session, and it is validated by the PKI realms with delegation.enabled toggled to true.
        See the docs for more details.
        Parameters:
        request - the request containing the certificate chain
        options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
        listener - the listener to be notified upon request completion