OAuthPrincipal
Namespace: Wisej.Web
Assembly: Wisej.Framework (4.2.0.0)
The principal assigned to User after a successful sign-in.
4.2.0+- C#
- VB.NET
public class OAuthPrincipal : ClaimsPrincipal
Public Class OAuthPrincipal
Inherits ClaimsPrincipal
Constructors
OAuthPrincipal(identity)
Initializes a new instance of the OAuthPrincipal class.
| Name | Type | Description |
|---|---|---|
| identity | OAuthIdentity | The signed-in identity. |
OAuthPrincipal(identity, roles)
Initializes a new instance of the OAuthPrincipal class and adds the specified roles as claims of the identity's role claim type.
| Name | Type | Description |
|---|---|---|
| identity | OAuthIdentity | The signed-in identity. |
| roles | IEnumerable<String> | The role names to add. Null is allowed and adds nothing. |
Each role becomes a claim of the identity's own RoleClaimType - always "roles", which CreateIdentity fixes - and not of a hard-coded claim type, so the inherited IsInRole finds them. This constructor is how an Authenticating handler adds roles from another source - Entra groups, for instance - while keeping this principal and its OAuthIdentity on User. A null or empty entry is skipped: a claim with no value is not a role.
Properties
Identity
OAuthIdentity: Returns the signed-in OAuthIdentity.
Provider
OAuthProvider: Returns the provider that authenticated this user.