set-security-user.asciidoc 1.9 KB

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