user-cache.asciidoc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. [role="xpack"]
  2. [[controlling-user-cache]]
  3. === Controlling the user cache
  4. User credentials are cached in memory on each node to avoid connecting to a
  5. remote authentication service or hitting the disk for every incoming request.
  6. You can configure characteristics of the user cache with the `cache.ttl`,
  7. `cache.max_users`, and `cache.hash_algo` realm settings.
  8. NOTE: PKI realms do not cache user credentials but do cache the resolved user
  9. object to avoid unnecessarily needing to perform role mapping on each request.
  10. The cached user credentials are hashed in memory. By default, the {es}
  11. {security-features} use a salted `sha-256` hash algorithm. You can use a
  12. different hashing algorithm by setting the `cache.hash_algo` realm settings. See
  13. <<hashing-settings>>.
  14. [[cache-eviction-api]]
  15. ==== Evicting users from the cache
  16. You can use the <<security-api-clear-cache,clear cache API>> to force
  17. the eviction of cached users . For example, the following request evicts all
  18. users from the `ad1` realm:
  19. [source,js]
  20. ------------------------------------------------------------
  21. $ curl -XPOST 'http://localhost:9200/_security/realm/ad1/_clear_cache'
  22. ------------------------------------------------------------
  23. To clear the cache for multiple realms, specify the realms as a comma-separated
  24. list:
  25. [source,js]
  26. ------------------------------------------------------------
  27. $ curl -XPOST 'http://localhost:9200/_security/realm/ad1,ad2/_clear_cache'
  28. ------------------------------------------------------------
  29. You can also evict specific users:
  30. [source, java]
  31. ------------------------------------------------------------
  32. $ curl -XPOST 'http://localhost:9200/_security/realm/ad1/_clear_cache?usernames=rdeniro,alpacino'
  33. ------------------------------------------------------------