> For the complete documentation index, see [llms.txt](https://docs.zongsoft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zongsoft.com/documentation/en/framework/core/components/identifier.md).

# Identifiers

From Discussions User Identity understands the type and value that together form the identity.

Identifier puts the identification class together with the identification value, so that the general security component does not have to rely on a specific forum user class. Discussions' UserIdentity implements the user contract, converting a UserId into a universal identity.

Source: [src/Security/UserIdentity.cs](https://github.com/Zongsoft/Zongsoft.Discussions/blob/main/src/Security/UserIdentity.cs#L102) (excerpt; see source for context).

{% code title="UserIdentity.cs" %}

```csharp
Identifier IIdentifiable.Identifier
{
	get => new(typeof(IUser), this.UserId);
	set => this.UserId = value.Validate<uint>(out var id) ? id : this.UserId;
}
#endregion
```

{% endcode %}

The type here is IUser, not UserIdentity. When setting the identifier, first verify whether the value can be used as a uint, and then update the UserId; if it does not meet the requirements, keep the original number. Identification is used to answer who the subject is and does not automatically load user profiles or grant permissions.

## Related Contracts

| Type           | responsibility                                   |
| -------------- | ------------------------------------------------ |
| IIdentifiable  | Provide unified identification attributes        |
| Identifier     | Save type, value and optional label, description |
| Identifier\<T> | Identification of a determined value type        |

UserIdentity also contains SiteId. The user number and site scope bear different responsibilities. After passing the Identifier across modules, business operations still need to restore or verify the current site and resource permissions. See [Authentication and Authorization](/documentation/en/framework/security/authentication.md).

Frame definition: [Identifier](https://github.com/Zongsoft/framework/blob/main/Zongsoft.Core/src/Components/Identifier.cs), [IIdentifiable](https://github.com/Zongsoft/framework/blob/main/Zongsoft.Core/src/Components/IIdentifiable.cs).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zongsoft.com/documentation/en/framework/core/components/identifier.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
