JwtSecurityTokenHandler Class

A SecurityTokenHandler designed for creating and validating JSON Web Tokens (JWT). See http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-07 for more information about the JWT specification.

Inheritance Hierarchy

System.IdentityModel.Tokens.SecurityTokenHandler
  System.IdentityModel.Tokens.JwtSecurityTokenHandler

Namespace:  System.IdentityModel.Tokens
Assembly:  System.IdentityModel.Tokens.Jwt (in System.IdentityModel.Tokens.Jwt.dll)

Syntax

'Declaration
Public Class JwtSecurityTokenHandler _
    Inherits SecurityTokenHandler
public class JwtSecurityTokenHandler : SecurityTokenHandler
public ref class JwtSecurityTokenHandler : public SecurityTokenHandler
type JwtSecurityTokenHandler =  
    class 
        inherit SecurityTokenHandler 
    end
public class JwtSecurityTokenHandler extends SecurityTokenHandler

The JwtSecurityTokenHandler type exposes the following members.

Constructors

  Name Description
Public method JwtSecurityTokenHandler Initializes an instance of JwtSecurityTokenHandler.

Top

Properties

  Name Description
Public property CanValidateToken Returns 'true' which indicates this instance can validate a JwtSecurityToken.
Public property CanWriteToken Returns 'true', which indicates this instance can write JwtSecurityToken.
Public property CertificateValidator Gets or sets the X509CertificateValidator responsible for validating the certificate that signed the JwtSecurityToken.
Public property DefaultTokenLifetimeInMinutes Gets or sets the default token lifetime.
Public propertyStatic member InboundAlgorithmMap Gets or sets the IDictionary<TKey, TValue> used to map Inbound Cryptographic Algorithms.
Public propertyStatic member InboundClaimTypeMap Gets or sets the InboundClaimTypeMap that is used when setting the Type for claims in the ClaimsPrincipal extracted when validating a JwtSecurityToken.The Type is set to the JSON claim 'name' after translating using this mapping.
Public property JwtSecurityTokenRequirement Gets or sets the JwtSecurityTokenRequirement.
Public property MaxClockSkew Gets or sets the clockskew to use when validating times.
Public property MaxTokenSizeInBytes Gets or sets the size limit when reading a token as a string.
Public property NameClaimType Gets or sets the String passed to ClaimsIdentity.
Public propertyStatic member OutboundAlgorithmMap Gets or sets the IDictionary<TKey, TValue> used to map Outbound Cryptographic Algorithms.
Public propertyStatic member OutboundClaimTypeMap Gets or sets the OutboundClaimTypeMap that is used when creating a JwtSecurityToken from Claim(s).The JSON claim 'name' value is set to Type after translating using this mapping.
Public property RequireExpirationTime Gets or sets a value indicating whether if the 'expiration' value in a JwtSecurityToken is required.
Public property RequireSignedTokens Gets or sets a value indicating whether a JwtSecurityToken can be valid if not signed.
Public property RoleClaimType Gets or sets the String passed to ClaimsIdentity.
Public propertyStatic member ShortClaimTypeProperty Gets or sets the property name of Properties the will contain the original JSON claim 'name' if a mapping occurred when the Claim(s) were created.See for more information.
Public property SignatureProviderFactory Gets or sets the SignatureProviderFactory for creating SignatureProvider(s).
Public property TokenType Gets the Type supported by this handler.

Top

Methods

  Name Description
Public method CanReadToken(String) Determines if the string is a well formed JSON Web Token (JWT).
Public method CanReadToken(XmlReader) Determines if the XmlReader is positioned on a well formed <BinarySecurityToken> element.
Protected method ClaimsIdentityFromJwt Creates a ClaimsIdentity from a JwtSecurityToken.
Protected method CreateActorValue Creates the 'value' for the actor claim: { actort, 'value' }
Public method CreateSecurityTokenReference Creates SecurityKeyIdentifierClause that identifies the SecurityToken.
Public method CreateToken(SecurityTokenDescriptor) Creates a JwtSecurityToken based on values found in the SecurityTokenDescriptor.
Public method CreateToken(String, String, ClaimsIdentity, Lifetime, SigningCredentials, SignatureProvider) Uses the JwtSecurityToken constructor, first creating the JwtHeader and JwtPayload.If SigningCredentials is not null, RawData will be signed.
Public method GetTokenTypeIdentifiers Gets the token type identifier(s) supported by this handler.
Public method LoadCustomConfiguration Loads custom configuration from an XmlNodeList. Override this method to provide custom handling of elements.
Public method ReadToken(String) Reads a token encoded in JSON Compact serialized format.
Public method ReadToken(XmlReader) Reads a JSON web token wrapped inside a WS-Security BinarySecurityToken xml element.
Protected method ValidateAudience(JwtSecurityToken) Validates that Audience is an expected value.
Protected method ValidateAudience(JwtSecurityToken, TokenValidationParameters) Validates that Audience is an expected value.
Protected method ValidateIssuer(JwtSecurityToken) Validates that Issuer is an expected value.
Protected method ValidateIssuer(JwtSecurityToken, TokenValidationParameters) Validates that Issuer is an expected value.
Protected method ValidateLifetime Validates ValidFrom and ValidTo.
Protected method ValidateSignature(JwtSecurityToken) Validates the signature of a JwtSecurityToken
Protected method ValidateSignature(JwtSecurityToken, TokenValidationParameters) Validates that the signature is valid.
Protected method ValidateSigningToken Validates the SigningToken is an expected value.
Public method ValidateToken(SecurityToken) Validates a JwtSecurityToken and returns ReadOnlyCollection<T>.
Public method ValidateToken(String) Reads and validates a token encoded in JSON Compact serialized format.
Public method ValidateToken(JwtSecurityToken) Validates a JwtSecurityToken and returns a ClaimsPrincipal.
Public method ValidateToken(String, TokenValidationParameters) Reads and validates a token encoded in JSON Compact serialized format.
Public method ValidateToken(JwtSecurityToken, TokenValidationParameters) Validates a JwtSecurityToken and returns a ClaimsPrincipal.
Public method WriteToken(SecurityToken) Writes the JwtSecurityToken as a JSON Compact serialized format string.
Public method WriteToken(XmlWriter, SecurityToken) Writes the JwtSecurityToken wrapped in a WS-Security BinarySecurityToken using the XmlWriter.

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.IdentityModel.Tokens Namespace