Class NativeRoleMappingStore
java.lang.Object
org.elasticsearch.xpack.security.authc.support.mapper.NativeRoleMappingStore
- All Implemented Interfaces:
org.elasticsearch.xpack.core.security.authc.support.UserRoleMapper
public class NativeRoleMappingStore
extends Object
implements org.elasticsearch.xpack.core.security.authc.support.UserRoleMapper
This store reads + writes
The store is responsible for all read and write operations as well as
role mappings in an Elasticsearch
index.
The store is responsible for all read and write operations as well as
resolving roles.
No caching is done by this class, it is handled at a higher level and no polling for changes is done by this class. Modification operations make a best effort attempt to clear the cache on all nodes for the user that was modified.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xpack.core.security.authc.support.UserRoleMapper
org.elasticsearch.xpack.core.security.authc.support.UserRoleMapper.DistinguishedNamePredicate, org.elasticsearch.xpack.core.security.authc.support.UserRoleMapper.UserData -
Constructor Summary
ConstructorsConstructorDescriptionNativeRoleMappingStore(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.client.internal.Client client, SecurityIndexManager securityIndex, org.elasticsearch.script.ScriptService scriptService) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.elasticsearch.xpack.core.security.authc.support.mapper.ExpressionRoleMappingbuildMapping(String id, org.elasticsearch.common.bytes.BytesReference source) voiddeleteRoleMapping(org.elasticsearch.xpack.core.security.action.rolemapping.DeleteRoleMappingRequest request, org.elasticsearch.action.ActionListener<Boolean> listener) Deletes a named mapping from the indexvoidgetRoleMappings(Set<String> names, org.elasticsearch.action.ActionListener<List<org.elasticsearch.xpack.core.security.authc.support.mapper.ExpressionRoleMapping>> listener) Retrieves one or more mappings from the index.protected voidloadMappings(org.elasticsearch.action.ActionListener<List<org.elasticsearch.xpack.core.security.authc.support.mapper.ExpressionRoleMapping>> listener) Loads all mappings from the index.voidonSecurityIndexStateChange(SecurityIndexManager.State previousState, SecurityIndexManager.State currentState) voidputRoleMapping(org.elasticsearch.xpack.core.security.action.rolemapping.PutRoleMappingRequest request, org.elasticsearch.action.ActionListener<Boolean> listener) Stores (create or update) a single mapping in the indexvoidrefreshRealmOnChange(org.elasticsearch.xpack.core.security.authc.support.CachingRealm realm) Indicates that the provided realm should have its cache cleared if this store is updated (that is,putRoleMapping(PutRoleMappingRequest, ActionListener)ordeleteRoleMapping(DeleteRoleMappingRequest, ActionListener)are called).voidresolveRoles(org.elasticsearch.xpack.core.security.authc.support.UserRoleMapper.UserData user, org.elasticsearch.action.ActionListener<Set<String>> listener) voidusageStats(org.elasticsearch.action.ActionListener<Map<String, Object>> listener) Provides usage statistics for this store.
-
Constructor Details
-
NativeRoleMappingStore
public NativeRoleMappingStore(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.client.internal.Client client, SecurityIndexManager securityIndex, org.elasticsearch.script.ScriptService scriptService)
-
-
Method Details
-
loadMappings
protected void loadMappings(org.elasticsearch.action.ActionListener<List<org.elasticsearch.xpack.core.security.authc.support.mapper.ExpressionRoleMapping>> listener) Loads all mappings from the index. package private for unit testing -
buildMapping
protected org.elasticsearch.xpack.core.security.authc.support.mapper.ExpressionRoleMapping buildMapping(String id, org.elasticsearch.common.bytes.BytesReference source) -
putRoleMapping
public void putRoleMapping(org.elasticsearch.xpack.core.security.action.rolemapping.PutRoleMappingRequest request, org.elasticsearch.action.ActionListener<Boolean> listener) Stores (create or update) a single mapping in the index -
deleteRoleMapping
public void deleteRoleMapping(org.elasticsearch.xpack.core.security.action.rolemapping.DeleteRoleMappingRequest request, org.elasticsearch.action.ActionListener<Boolean> listener) Deletes a named mapping from the index -
getRoleMappings
public void getRoleMappings(Set<String> names, org.elasticsearch.action.ActionListener<List<org.elasticsearch.xpack.core.security.authc.support.mapper.ExpressionRoleMapping>> listener) Retrieves one or more mappings from the index. Ifnamesisnullorempty, then this retrieves all mappings. Otherwise it retrieves the specified mappings by name. -
usageStats
Provides usage statistics for this store. The resulting map contains the keyssize- The total number of mappings stored in the indexenabled- The number of mappings that areenabled
-
onSecurityIndexStateChange
public void onSecurityIndexStateChange(SecurityIndexManager.State previousState, SecurityIndexManager.State currentState) -
resolveRoles
public void resolveRoles(org.elasticsearch.xpack.core.security.authc.support.UserRoleMapper.UserData user, org.elasticsearch.action.ActionListener<Set<String>> listener) - Specified by:
resolveRolesin interfaceorg.elasticsearch.xpack.core.security.authc.support.UserRoleMapper
-
refreshRealmOnChange
public void refreshRealmOnChange(org.elasticsearch.xpack.core.security.authc.support.CachingRealm realm) Indicates that the provided realm should have its cache cleared if this store is updated (that is,putRoleMapping(PutRoleMappingRequest, ActionListener)ordeleteRoleMapping(DeleteRoleMappingRequest, ActionListener)are called).- Specified by:
refreshRealmOnChangein interfaceorg.elasticsearch.xpack.core.security.authc.support.UserRoleMapper- See Also:
-
ClearRealmCacheAction
-