Validators.ValidateLifetime Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ValidateLifetime(Nullable<DateTime>, Nullable<DateTime>, SecurityToken, TokenValidationParameters) |
Validates the lifetime of a SecurityToken. |
ValidateLifetime(Nullable<DateTime>, Nullable<DateTime>, SecurityToken, ValidationParameters, CallContext) |
Validates the lifetime of a SecurityToken. |
ValidateLifetime(Nullable<DateTime>, Nullable<DateTime>, SecurityToken, TokenValidationParameters)
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
The 'notBefore' time found in the SecurityToken.
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
ValidateLifetime(Nullable<DateTime>, Nullable<DateTime>, SecurityToken, ValidationParameters, CallContext)
Validates the lifetime of a SecurityToken.
public static Microsoft.IdentityModel.Tokens.Experimental.ValidationResult<Microsoft.IdentityModel.Tokens.Experimental.ValidatedLifetime,Microsoft.IdentityModel.Tokens.Experimental.LifetimeValidationError> ValidateLifetime(DateTime? notBefore, DateTime? expires, Microsoft.IdentityModel.Tokens.SecurityToken? securityToken, Microsoft.IdentityModel.Tokens.Experimental.ValidationParameters validationParameters, Microsoft.IdentityModel.Tokens.CallContext callContext);
static member ValidateLifetime : Nullable<DateTime> * Nullable<DateTime> * Microsoft.IdentityModel.Tokens.SecurityToken * Microsoft.IdentityModel.Tokens.Experimental.ValidationParameters * Microsoft.IdentityModel.Tokens.CallContext -> Microsoft.IdentityModel.Tokens.Experimental.ValidationResult<Microsoft.IdentityModel.Tokens.Experimental.ValidatedLifetime, Microsoft.IdentityModel.Tokens.Experimental.LifetimeValidationError>
Public Shared Function ValidateLifetime (notBefore As Nullable(Of DateTime), expires As Nullable(Of DateTime), securityToken As SecurityToken, validationParameters As ValidationParameters, callContext As CallContext) As ValidationResult(Of ValidatedLifetime, LifetimeValidationError)
Parameters
The 'notBefore' time found in the SecurityToken.
The 'expiration' time found in the SecurityToken.
- securityToken
- SecurityToken
The SecurityToken being validated.
- validationParameters
- ValidationParameters
The ValidationParameters to be used for validating the token.
- callContext
- CallContext
The CallContext that contains call information.
Returns
A ValidationResult<TResult,TError> indicating whether validation was successful, and providing a SecurityTokenInvalidLifetimeException if it was not.
Remarks
All time comparisons apply ClockSkew.