共用方式為


Validators.ValidateLifetime 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
Nullable<DateTime>

The 'notBefore' time found in the SecurityToken.

expires
Nullable<DateTime>

The 'expiration' time found in the SecurityToken.

securityToken
SecurityToken

The SecurityToken being validated.

validationParameters
TokenValidationParameters

TokenValidationParameters required for validation.

Exceptions

If 'validationParameters' 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