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.​SecurityTokenHandler

Assembly: Microsoft.IdentityModel.Tokens

Inheritance: object → TokenHandler → SecurityTokenHandler

Implemented Interfaces

Defines the interface for a Security Token Handler.

Properties

public bool
CanValidateToken
Gets a value indicating whether this handler supports validation of tokens handled by this instance.
public bool
CanWriteToken
Gets a value indicating whether the class provides serialization functionality to serialize token handled by this instance.
TokenType
This must be overridden to get the System.Type of the SecurityToken this instance handles.
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

CreateSecurityTokenReference​(SecurityToken token, bool attached)
Returns <see cref="T:Microsoft.IdentityModel.Tokens.SecurityKeyIdentifierClause" /> .
token <see cref="T:Microsoft.IdentityModel.Tokens.SecurityToken" />
attached true if attached; otherwise, false.
public SecurityToken
CreateToken​(SecurityTokenDescriptor tokenDescriptor)
Returns <see cref="T:Microsoft.IdentityModel.Tokens.SecurityToken" /> .
tokenDescriptor <see cref="T:Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor" />
public bool
CanReadToken​(System.​Xml.​XmlReader reader)
Indicates whether the <see cref="T:System.Xml.XmlReader" /> is positioned at an element that can be read.
Returns 'true' if the token can be read.
reader An <see cref="T:System.Xml.XmlReader" /> reader positioned at a start element. The reader should not be advanced.
public bool
CanReadToken​(string tokenString)
Indicates whether the current token string can be read as a token of the type handled by this instance.
Returns 'True' if the ReadToken method can parse the token string.
tokenString The token string thats needs to be read.
public SecurityToken
ReadToken​(System.​Xml.​XmlReader reader)
Gets security token.
reader <see cref="T:System.Xml.XmlReader" /> .
Remarks SecurityToken instance which represents the serialized token.
public string
WriteToken​(SecurityToken token)
Serializes to string a token of the type handled by this instance.
Returns The serialized token.
token A token of type TokenType.
public void
WriteToken​(System.​Xml.​XmlWriter writer, SecurityToken token)
This must be overridden to serialize to XML a token of the type handled by this instance.
writer The XML writer.
token A token of type <see cref="P:Microsoft.IdentityModel.Tokens.SecurityTokenHandler.TokenType" /> .
public SecurityToken
ReadToken​(System.​Xml.​XmlReader reader, TokenValidationParameters validationParameters)
This must be overridden to deserialize token with the provided <see cref="T:Microsoft.IdentityModel.Tokens.TokenValidationParameters" /> .
reader <see cref="T:System.Xml.XmlReader" /> .
validationParameters The <see cref="T:Microsoft.IdentityModel.Tokens.TokenValidationParameters" /> to be used for validating the token.
Remarks SecurityToken instance which represents the serialized token.
ValidateToken​(string securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
ValidateToken​(System.​Xml.​XmlReader reader, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
ValidateTokenAsync​(string token, TokenValidationParameters validationParameters)
Inherited from TokenHandler
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)
Inherited from TokenHandler
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)
Inherited from TokenHandler
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