-
Notifications
You must be signed in to change notification settings - Fork 1
SecurityPrincipal
Nill edited this page Dec 29, 2021
·
1 revision
A security principal is any construct that can be used as the source of a security decision; typically this involves users and groups, but also involves well-known security principals.
Security principals implement the ISecurityPrincipal interface which looks like this:
| Member | Type | Description |
|---|---|---|
| DisplayText | string | Text used for display purposes (e.g. "@nillkitty") |
| StorageText | string | The internal data used to uniquely identify the principal |
| Matches(Context) | bool | Whether the active user of the Context matches the principal or not |
| MatchesUser(User) | bool | Whether the user specified matches the principal or not |
| Equals(ISecurityPrincipal) | bool | Whether the security principal referenced is essentially identical to this one or not. |
| Type | Details |
|---|---|
Telefrag.Telegram.BotAPI.User |
Matches the only the user in question |
Telefrag.Security.Group |
Matches any user in the group |
Telefrag.Security.WellKnownPrincipal |
Matches select users based on the WKP involved (e.g. "Anonymous" matches only anonymous users). |
Just as in Windows, Telefrag has the concept of a Well-known security principal, which is a generic pre-defined identifier that matches some subset of user contexts.
The predefined well known principals are:
| Name | Matches |
|---|---|
| Everyone | All contexts |
| Nobody | No contexts |
| Authenticated | Contexts with an authenticated user |
| Anonymous | Contexts without an authenticated user |
| Telegram | Contexts associated with a Telegram update |
| Private | Contexts associated with a Telegram private chat |
| GroupChat | Contexts associated with a Telegram group chat |
| Channel | Contexts associated with a Telegram channel |