# User API

The user API provides information about the currently authenticated user.

The endpoint is `/user/whoami` which will return a JSON object on a GET request. The JSON object tells the client which PASS object represents the authenticated user.

Example result:

```JSON
{
  "id": "1234",
  "type": "user",
  "uri": "http://localhost:8080/data/user/1234"
}
```

The parameter `userToken` can be used to provide a user token. The user token must be associated with a submission and an email address. A user token is an encrypted tuple consisting of a PASS resource URI and a reference URI. A request with a user token will return as normal, but have the side effect of setting the submitter of the submission to the current user. In order for that to happen the submitterEmail address field on the submission must match the email address of the token.

Then environment variable `PASS_CORE_USERTOKEN_KEY` provides the key used to encrypt and decrypt user tokens. If it is not provided or empty, user token support is disabled. To generate a key run the class, `org.eclipse.pass.usertoken.KeyGenerator`. One way to do that is from `pass-core-usertoken` to do `mvn compile exec:java -Dexec.mainClass="org.eclipse.pass.usertoken.KeyGenerator"`.

The purpose of user tokens is to handle the case of a request for a user who has not logged into PASS and so does not have a User object to handle a submission. This is part of the proxy functionality.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eclipse-pass.org/developer-documentation/pass-core/api/user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
