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 | |
---|---|---|
JwtSecurityTokenHandler | Initializes an instance of JwtSecurityTokenHandler. |
Top
Properties
Name | Description | |
---|---|---|
CanValidateToken | Returns 'true' which indicates this instance can validate a JwtSecurityToken. | |
CanWriteToken | Returns 'true', which indicates this instance can write JwtSecurityToken. | |
CertificateValidator | Gets or sets the X509CertificateValidator responsible for validating the certificate that signed the JwtSecurityToken. | |
DefaultTokenLifetimeInMinutes | Gets or sets the default token lifetime. | |
InboundAlgorithmMap | Gets or sets the IDictionary<TKey, TValue> used to map Inbound Cryptographic Algorithms. | |
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. | |
JwtSecurityTokenRequirement | Gets or sets the JwtSecurityTokenRequirement. | |
MaxClockSkew | Gets or sets the clockskew to use when validating times. | |
MaxTokenSizeInBytes | Gets or sets the size limit when reading a token as a string. | |
NameClaimType | Gets or sets the String passed to ClaimsIdentity. | |
OutboundAlgorithmMap | Gets or sets the IDictionary<TKey, TValue> used to map Outbound Cryptographic Algorithms. | |
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. | |
RequireExpirationTime | Gets or sets a value indicating whether if the 'expiration' value in a JwtSecurityToken is required. | |
RequireSignedTokens | Gets or sets a value indicating whether a JwtSecurityToken can be valid if not signed. | |
RoleClaimType | Gets or sets the String passed to ClaimsIdentity. | |
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. | |
SignatureProviderFactory | Gets or sets the SignatureProviderFactory for creating SignatureProvider(s). | |
TokenType | Gets the Type supported by this handler. |
Top
Methods
Name | Description | |
---|---|---|
CanReadToken(String) | Determines if the string is a well formed JSON Web Token (JWT). | |
CanReadToken(XmlReader) | Determines if the XmlReader is positioned on a well formed <BinarySecurityToken> element. | |
ClaimsIdentityFromJwt | Creates a ClaimsIdentity from a JwtSecurityToken. | |
CreateActorValue | Creates the 'value' for the actor claim: { actort, 'value' } | |
CreateSecurityTokenReference | Creates SecurityKeyIdentifierClause that identifies the SecurityToken. | |
CreateToken(SecurityTokenDescriptor) | Creates a JwtSecurityToken based on values found in the SecurityTokenDescriptor. | |
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. | |
GetTokenTypeIdentifiers | Gets the token type identifier(s) supported by this handler. | |
LoadCustomConfiguration | Loads custom configuration from an XmlNodeList. Override this method to provide custom handling of elements. | |
ReadToken(String) | Reads a token encoded in JSON Compact serialized format. | |
ReadToken(XmlReader) | Reads a JSON web token wrapped inside a WS-Security BinarySecurityToken xml element. | |
ValidateAudience(JwtSecurityToken) | Validates that Audience is an expected value. | |
ValidateAudience(JwtSecurityToken, TokenValidationParameters) | Validates that Audience is an expected value. | |
ValidateIssuer(JwtSecurityToken) | Validates that Issuer is an expected value. | |
ValidateIssuer(JwtSecurityToken, TokenValidationParameters) | Validates that Issuer is an expected value. | |
ValidateLifetime | Validates ValidFrom and ValidTo. | |
ValidateSignature(JwtSecurityToken) | Validates the signature of a JwtSecurityToken | |
ValidateSignature(JwtSecurityToken, TokenValidationParameters) | Validates that the signature is valid. | |
ValidateSigningToken | Validates the SigningToken is an expected value. | |
ValidateToken(SecurityToken) | Validates a JwtSecurityToken and returns ReadOnlyCollection<T>. | |
ValidateToken(String) | Reads and validates a token encoded in JSON Compact serialized format. | |
ValidateToken(JwtSecurityToken) | Validates a JwtSecurityToken and returns a ClaimsPrincipal. | |
ValidateToken(String, TokenValidationParameters) | Reads and validates a token encoded in JSON Compact serialized format. | |
ValidateToken(JwtSecurityToken, TokenValidationParameters) | Validates a JwtSecurityToken and returns a ClaimsPrincipal. | |
WriteToken(SecurityToken) | Writes the JwtSecurityToken as a JSON Compact serialized format string. | |
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.