Class UserProfileExt
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
Methods
AccessTokenExpiresOn(IIdentity)
Gets the expiration date of the access token, from its exp claim.
public static DateTime AccessTokenExpiresOn(this IIdentity identity)
Parameters
identityIIdentityThe identity, which must be a ClaimsIdentity.
Returns
- DateTime
The expiration date. The Unix epoch is returned when the identity has no valid
expclaim.
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
identityIIdentityThe identity, which must be a ClaimsIdentity.
Returns
- DateTime
The expiration date in UTC. The Unix epoch is returned when the identity has no valid
expclaim.
Exceptions
- InvalidOperationException
The identity is not a ClaimsIdentity.