set-security-user.asciidoc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. [[ingest-node-set-security-user-processor]]
  2. === Set security user processor
  3. ++++
  4. <titleabbrev>Set security user</titleabbrev>
  5. ++++
  6. Sets user-related details (such as `username`, `roles`, `email`, `full_name`,
  7. `metadata`, `api_key`, `realm` and `authentication_type`) from the current
  8. authenticated user to the current document by pre-processing the ingest.
  9. The `api_key` property exists only if the user authenticates with an
  10. API key. It is an object containing the `id` and `name` fields of the API key.
  11. The `realm` property is also an object with two fields, `name` and `type`.
  12. When using API key authentication, the `realm` property refers to the realm
  13. from which the API key is created.
  14. The `authentication_type` property is a string that can take value from
  15. `REALM`, `API_KEY`, `TOKEN` and `ANONYMOUS`.
  16. IMPORTANT: Requires an authenticated user for the index request.
  17. [[set-security-user-options]]
  18. .Set Security User Options
  19. [options="header"]
  20. |======
  21. | Name | Required | Default | Description
  22. | `field` | yes | - | The field to store the user information into.
  23. | `properties` | no | [`username`, `roles`, `email`, `full_name`, `metadata`, `api_key`, `realm`, `authentication_type`] | Controls what user related properties are added to the `field`.
  24. include::common-options.asciidoc[]
  25. |======
  26. The following example adds all user details for the current authenticated user
  27. to the `user` field for all documents that are processed by this pipeline:
  28. [source,js]
  29. --------------------------------------------------
  30. {
  31. "processors" : [
  32. {
  33. "set_security_user": {
  34. "field": "user"
  35. }
  36. }
  37. ]
  38. }
  39. --------------------------------------------------
  40. // NOTCONSOLE