user-cache.asciidoc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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: JWT realms use `jwt.cache.ttl` and `jwt.cache.size` realm settings.
  9. NOTE: PKI and JWT realms do not cache user credentials, but do cache the resolved user
  10. object to avoid unnecessarily needing to perform role mapping on each request.
  11. The cached user credentials are hashed in memory. By default, the {es}
  12. {security-features} use a salted `sha-256` hash algorithm. You can use a
  13. different hashing algorithm by setting the `cache.hash_algo` realm settings. See
  14. <<hashing-settings>>.
  15. [[cache-eviction-api]]
  16. ==== Evicting users from the cache
  17. You can use the <<security-api-clear-cache,clear cache API>> to force
  18. the eviction of cached users . For example, the following request evicts all
  19. users from the `ad1` realm:
  20. [source,js]
  21. ------------------------------------------------------------
  22. $ curl -XPOST 'http://localhost:9200/_security/realm/ad1/_clear_cache'
  23. ------------------------------------------------------------
  24. To clear the cache for multiple realms, specify the realms as a comma-separated
  25. list:
  26. [source,js]
  27. ------------------------------------------------------------
  28. $ curl -XPOST 'http://localhost:9200/_security/realm/ad1,ad2/_clear_cache'
  29. ------------------------------------------------------------
  30. You can also evict specific users:
  31. [source, java]
  32. ------------------------------------------------------------
  33. $ curl -XPOST 'http://localhost:9200/_security/realm/ad1/_clear_cache?usernames=rdeniro,alpacino'
  34. ------------------------------------------------------------