<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.22.0" />

Microsoft.IdentityModel.Tokens.TokenHandler

public abstract class TokenHandler
Defines properties shared across all security token handlers.
public static readonly int DefaultTokenLifetimeInMinutes

Default lifetime of tokens created. When creating tokens, if 'expires', 'notbefore' or 'issuedat' are null, then a default will be set to: issuedat = DateTime.UtcNow, notbefore = DateTime.UtcNow, expires = DateTime.UtcNow + TimeSpan.FromMinutes(TokenLifetimeInMinutes).

public virtual int MaximumTokenSizeInBytes { get; set; }

Gets and sets the maximum token size in bytes that will be processed.

public bool SetDefaultTimesOnTokenCreation { get; set; }

Gets or sets a bool that controls if token creation will set default 'exp', 'nbf' and 'iat' if not specified.

public int TokenLifetimeInMinutes { get; set; }

Gets or sets the token lifetime in minutes.

protected TokenHandler()

public virtual SecurityToken ReadToken(string token)

Converts a string into an instance of SecurityToken.

public virtual Task<TokenValidationResult> ValidateTokenAsync(string token, TokenValidationParameters validationParameters)

Validates a token. On a validation failure, no exception will be thrown; instead, the exception will be set in the returned TokenValidationResult.Exception property. Callers should always check the TokenValidationResult.IsValid property to verify the validity of the result.

Validates a token. On a validation failure, no exception will be thrown; instead, the exception will be set in the returned TokenValidationResult.Exception property. Callers should always check the TokenValidationResult.IsValid property to verify the validity of the result.