Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class Microsoft.​IdentityModel.​Tokens.​TokenHandler

Assembly: Microsoft.IdentityModel.Tokens

Inheritance: object → TokenHandler

Defines properties shared across all security token handlers.

Fields and Constants

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).
Remarks See: <see cref="P:Microsoft.IdentityModel.Tokens.TokenHandler.SetDefaultTimesOnTokenCreation" /> for configuration.

Properties

public int
MaximumTokenSizeInBytes
Gets and sets the maximum token size in bytes that will be processed.
public bool
SetDefaultTimesOnTokenCreation
Gets or sets a bool that controls if token creation will set default 'exp', 'nbf' and 'iat' if not specified.
Remarks See: <see cref="P:Microsoft.IdentityModel.Tokens.TokenHandler.TokenLifetimeInMinutes" /> for configuration.
public int
TokenLifetimeInMinutes
Gets or sets the token lifetime in minutes.
Remarks Used during token creation to set the default expiration ('exp').

Methods

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.
Returns A <see cref="T:Microsoft.IdentityModel.Tokens.TokenValidationResult" />
token The token to be validated.
validationParameters The <see cref="T:Microsoft.IdentityModel.Tokens.TokenValidationParameters" /> to be used for validating the token.
ValidateTokenAsync​(SecurityToken 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.
Returns A <see cref="T:Microsoft.IdentityModel.Tokens.TokenValidationResult" />
token The <see cref="T:Microsoft.IdentityModel.Tokens.SecurityToken" /> to be validated.
validationParameters The <see cref="T:Microsoft.IdentityModel.Tokens.TokenValidationParameters" /> to be used for validating the token.
public SecurityToken
ReadToken​(string token)
Converts a string into an instance of <see cref="T:Microsoft.IdentityModel.Tokens.SecurityToken" /> .
Returns A <see cref="T:Microsoft.IdentityModel.Tokens.SecurityToken" /> .
token The string to be deserialized.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object