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

Microsoft.IdentityModel.Tokens.SecurityTokenHandler

Defines the interface for a Security Token Handler.
public virtual bool CanValidateToken { get; }

Gets a value indicating whether this handler supports validation of tokens handled by this instance.

public virtual bool CanWriteToken { get; }

Gets a value indicating whether the class provides serialization functionality to serialize token handled by this instance.

public abstract Type TokenType { get; }

This must be overridden to get the System.Type of the SecurityToken this instance handles.

Creates an instance of SecurityTokenHandler

public virtual bool CanReadToken(XmlReader reader)

Indicates whether the XmlReader is positioned at an element that can be read.

public virtual bool CanReadToken(string tokenString)

Indicates whether the current token string can be read as a token of the type handled by this instance.

Returns SecurityKeyIdentifierClause.

public virtual SecurityToken CreateToken(SecurityTokenDescriptor tokenDescriptor)

Returns SecurityToken.

public virtual SecurityToken ReadToken(XmlReader reader)

Gets security token.

public abstract SecurityToken ReadToken(XmlReader reader, TokenValidationParameters validationParameters)

This must be overridden to deserialize token with the provided TokenValidationParameters.

public virtual ClaimsPrincipal ValidateToken(string securityToken, TokenValidationParameters validationParameters, out SecurityToken validatedToken)

This must be overridden to validate a token passed as a string using TokenValidationParameters

public virtual ClaimsPrincipal ValidateToken(XmlReader reader, TokenValidationParameters validationParameters, out SecurityToken validatedToken)

Reads and validates a token using a xmlReader and TokenValidationParameters

public virtual string WriteToken(SecurityToken token)

Serializes to string a token of the type handled by this instance.

public abstract void WriteToken(XmlWriter writer, SecurityToken token)

This must be overridden to serialize to XML a token of the type handled by this instance.