Skip to main content
Version: 4.2

OAuthIdentity

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.2.0.0)

The identity of a user signed in through OAuthClient. Derives from ClaimsIdentity, so it satisfies IIdentity for free and reports IsAuthenticated as true simply because its authentication type is never empty — which is exactly what IsAuthenticated reads.

4.2.0+
public class OAuthIdentity : ClaimsIdentity

No access token, refresh token or ID token is a member of this class, and it holds no reference back to the component. It can therefore be assigned to User, logged, bound to a grid or handed to another layer with nothing sensitive riding along. Code that needs a bearer token calls GetAccessToken. Provider-specific data travels as claims rather than as invented properties, and role checks work through the role claim type. On .NET 8 the same principal can be handed to ASP.NET Core cookie sign-in unchanged.

Properties​

Instance member AuthenticatedAt​

DateTimeOffset: Returns when this identity was created, in UTC.

Instance member DisplayName​

String: Returns the display name, or null: "name", then the claim type that supplies Name - the descriptor's name claim, or the one type a ProviderResolved handler assigned to NameClaimType - then "preferred_username". For GitHub that claim type is "login", so name falling back to login. Computed at construction: an Authenticating handler that replaces the "name" claim changes what FindFirst("name") returns, not this value.

Instance member Email​

String: Returns the email address, or null. This is always the provider's own "email" claim, read at construction: nothing writes a chosen display name into it, even on Google, whose default name claim is "email", and an Authenticating handler's claim edits do not change it.

Instance member EmailVerified​

Boolean: Returns whether the provider asserts the email is verified. Google reports email_verified; GitHub reports the verified flag on the primary email; GitLab reports email_verified for the user's public email and nothing when there is none; Entra is always false, because it makes no such assertion; a custom provider reports email_verified.

Instance member FamilyName​

String: Returns the family name, or null.

Instance member GivenName​

String: Returns the given name, or null.

Instance member Issuer​

String: Returns the validated issuer of the ID token, or the provider's issuer.

Instance member Picture​

String: Returns the picture or avatar URL, or null.

Instance member Provider​

OAuthProvider: Returns the provider that authenticated this user.

Instance member RawIdTokenClaims​

Object: Returns the raw ID token payload as a DynamicObject, or null.

Instance member RawUserInfo​

Object: Returns the raw userinfo document as a DynamicObject, or null.

Instance member Subject​

String: Returns the provider's stable identifier for this user: Google sub, GitHub id, Entra oid, GitLab sub, custom sub. Also present as a NameIdentifier claim.

Instance member TenantId​

String: Returns the Entra tid claim, or the Google hd claim, or null.