Validators.ValidateLifetime(Nullable<DateTime>, Nullable<DateTime>, SecurityToken, TokenValidationParameters) Method

Definition

Validates the lifetime of a SecurityToken.

public static void ValidateLifetime (DateTime? notBefore, DateTime? expires, Microsoft.IdentityModel.Tokens.SecurityToken securityToken, Microsoft.IdentityModel.Tokens.TokenValidationParameters validationParameters);
static member ValidateLifetime : Nullable<DateTime> * Nullable<DateTime> * Microsoft.IdentityModel.Tokens.SecurityToken * Microsoft.IdentityModel.Tokens.TokenValidationParameters -> unit
Public Shared Sub ValidateLifetime (notBefore As Nullable(Of DateTime), expires As Nullable(Of DateTime), securityToken As SecurityToken, validationParameters As TokenValidationParameters)

Parameters

notBefore
System.Nullable<System.DateTime>

The 'notBefore' time found in the SecurityToken.

expires
System.Nullable<System.DateTime>

The 'expiration' time found in the SecurityToken.

securityToken
SecurityToken

The SecurityToken being validated.

validationParameters
TokenValidationParameters

TokenValidationParameters required for validation.

Exceptions

System.ArgumentNullException

If 'vaidationParameters' is null.

If 'expires.HasValue' is false and RequireExpirationTime is true.

If 'notBefore' is > 'expires'.

If 'notBefore' is > DateTime.UtcNow.

If 'expires' is < DateTime.UtcNow.

Remarks

All time comparisons apply ClockSkew.

Applies to