| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 | [role="xpack"][[user-profile]]=== User profilesNOTE: The user profile feature is designed only for use by {kib} andElastic’s {observability}, {ents}, and {elastic-sec} solutions. Individualusers and external applications should not call this API directly. Elastic reservesthe right to change or remove this feature in future releases without prior notice.Because the {stack} supports externally-managed users (such as users whoauthenticate via SAML, or users stored in an LDAP directory), there's adistinction between _users_ and their _profile_._Users_ refer to the entities that authenticate requests to the {stack}.Each user has a username and a set of privileges (represented by <<roles,roles>>)that determine which types of requests they can issue. Users can be ephemeral;they might exist only for the duration of a request to an {es} API or for thelifetime of a session in {kib}. These users cannot be retrieved after the sessionends, and can't store preferences across sessions._User profiles_ provide persistent and stable representations of users.A user profile exists even if the user is offline, so their profile persists across sessions.The unique identifier assigned to each profile doesn't changethroughout the lifetime of a deployment, providing a stable way of referringto the associated user. Each profile has a unique identifier, is searchable, andcan store user data such as format and notification preferences.The capability of uniquely referring to users regardless of whether they'reactively online is a critical function that underpins important features likepersonalization and collaboration in {kib}.==== User profiles in {kib}A user profile is the persistent record that the {stack} stores for eachinteractive user that authenticates to {kib}.When a user logs in to {kib}, a profile is automatically created for the user,or an existing profile is updated to reflect the user's active session.By using the unique ID of the user profile, {kib} can store user-level data such as preferencesseparately for each user, which is key to fine-grained levels of customization.{kib} uses this unique ID to route messages and notifications to a distinct user,regardless of whether they're logged in.===== Usernames and user profilesYou can use the same username across multiple realms for a single user. In {es},it's possible for two different realms to authenticate users with the same usernameand different roles.{es} doesn't assume that these users are the same person, and treatsthem as separate individuals with distinct user profiles by default.NOTE: For use cases where one individual can authenticate againstmultiple realms, you can use the <<security-domain,security domain>> featureso that these distinct users are considered to be the same identityand share a single user profile.==== Create and manage user profilesTo create a new user profile or update an existing one, use the<<security-api-activate-user-profile,activate user profile API>>. When yousubmit a request, {es} attempts to locate an existing profile document for thespecified user. If one doesn't exist, {es} creates a new profile document.In either case, the profile document captures the user's `full_name`, `email`,`roles`, and `realms`, and also includes the profile unique ID and timestamp ofthe operation. You can retrieve a user profile withthe <<security-api-get-user-profile,get user profile API>> by including theprofile's unique ID (`uid`).In addition to the user's basic information, you can add data to a profile documentwith the <<security-api-update-user-profile-data,update user profile API>>. Forexample, you can add user-specific preferences as part of the profile data.Use the <<security-api-suggest-user-profile,suggest user profile API>> to retrieve profilesthat match given criteria. This API is designed to support user-suggestions,in collaboration with features such as those found in {kib}.However, the suggest user profile API is not intended to provide a general-purpose search API.Lastly, you can use the <<security-api-has-privileges-user-profile, has privileges API foruser profiles>> to check the privileges of multiple users by specifying their profiles' unique IDs.This can be used in conjunction with the suggest user profile API in order to restrict thesuggestions only to users that have the necessary permissions to actually performthe action in the context.==== Limitations* Creating a new user profile requires a user's authentication details(`username` and `password` or its<<token-authentication-services,OAuth2 access token>>).This means that a user must authenticate at least one time to create auser profile. Users who have never authenticated to {kib}(or another profile-aware application) won't have a user profile, and the<<security-api-suggest-user-profile,suggest user profile API>> won't returnany results for those users.* User profiles are meant for interactive users, such as a human user whointeracts with {kib}. Therefore, user profiles don't support API keys or<<service-accounts,service accounts>>.+NOTE: <<token-authentication-services,OAuth2 tokens>> that represent aninteractive end-user are supported.
 |