Table of Contents

Class UserProfileExt

Namespace
Arc4u.OAuth2.Token
Assembly
Arc4u.OAuth2.dll

Extension methods reading the access token expiration from the exp claim of an identity.

public static class UserProfileExt
Inheritance
UserProfileExt
Inherited Members

Fields

tokenExpirationClaimType

The claim type (exp) holding the expiration date of the access token, in Unix seconds.

public static readonly string tokenExpirationClaimType

Field Value

string

Methods

AccessTokenExpiresOn(IIdentity)

Gets the expiration date of the access token, from its exp claim.

public static DateTime AccessTokenExpiresOn(this IIdentity identity)

Parameters

identity IIdentity

The identity, which must be a ClaimsIdentity.

Returns

DateTime

The expiration date. The Unix epoch is returned when the identity has no valid exp claim.

Exceptions

InvalidOperationException

The identity is not a ClaimsIdentity.

AccessTokenExpiresOnUtc(IIdentity)

Gets the expiration date of the access token in UTC, from its exp claim.

public static DateTime AccessTokenExpiresOnUtc(this IIdentity identity)

Parameters

identity IIdentity

The identity, which must be a ClaimsIdentity.

Returns

DateTime

The expiration date in UTC. The Unix epoch is returned when the identity has no valid exp claim.

Exceptions

InvalidOperationException

The identity is not a ClaimsIdentity.