JwtSecurityToken Class

A class that represents a JSON Web Token (JWT).

Inheritance Hierarchy

System.Object
  System.IdentityModel.Tokens.SecurityToken
    System.IdentityModel.Tokens.JwtSecurityToken

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

Syntax

'Declaration
Public Class JwtSecurityToken _
    Inherits SecurityToken
public class JwtSecurityToken : SecurityToken
public ref class JwtSecurityToken : public SecurityToken
type JwtSecurityToken =  
    class 
        inherit SecurityToken 
    end
public class JwtSecurityToken extends SecurityToken

The JwtSecurityToken type exposes the following members.

Constructors

  Name Description
Public method JwtSecurityToken(String) Constructs a JwtSecurityToken from a string in JSON Web Signature (JWS) Compact serialized format.
Public method JwtSecurityToken(JwtHeader, JwtPayload, String) Constructs a JwtSecurityToken where the JwtHeader contains the crypto algorithms applied to the encoded JwtHeader and JwtPayload. The jwtEncodedString is the result of those operations.
Public method JwtSecurityToken(String, String, IEnumerable<Claim>, Lifetime, SigningCredentials) Constructs a JwtSecurityToken specifying optional parameters.

Top

Properties

  Name Description
Public property Actor Gets the 'value' of the actor claim from JSON in the form of { actor, 'value' }.
Public property Audience Gets the 'value' of the audience claim from JSON in the form of { aud, 'value' }.
Public property Claims Gets the Claim(s) for this token.
Public property EncodedHeader Gets the [Base64UrlEncoded]JwtHeader associated with this instance.
Public property EncodedPayload Gets the [Base64UrlEncoded]JwtPayload associated with this instance.
Public property EncodedSignature Gets the current signature over the JWT.
Public property Expiration Gets the 'value' of the expiration claim from JSON in the form of { aud, 'exp' }.
Public property Header Gets the JwtHeader associated with this instance.
Public property Id Gets the 'value' of the JWT ID claim from JSON in the form of { jti, 'value' }. (Overrides SecurityToken.Id.)
Public property IssuedAt Gets the 'value' of the Issued At claim from JSON in the form of { iat, 'value' }.
Public property Issuer Gets the 'value' of the issuer claim from JSON in the form of { iss, 'value' }.
Public property Payload Gets the JwtPayload associated with this instance.
Public property RawData Gets the original raw data of this instance when it was created.
Public property SecurityKeys Gets a collection of SecurityKey objects for this instance. (Overrides SecurityToken.SecurityKeys.)
Public property SignatureAlgorithm Gets the signature algorithm associated with this instance.
Public property SigningCredentials Gets the SigningCredentials associated with this instance.
Public property SigningKey Gets or sets the SecurityKey that signed this instance.
Public property SigningToken Gets or sets the SecurityToken that contains a SecurityKey that signed this instance.
Public property Subject Gets ‘value’ of the subject claim from JSON in the form of { sub, 'value' }.
Public property ValidFrom Gets 'value' of the notbefore claim from JSON in the form of { nbf, 'value' } converted to a DateTime object assuming 'value' is seconds since UnixEpoch (UTC 1970-01-01T0:0:0Z). (Overrides SecurityToken.ValidFrom.)
Public property ValidTo Gets 'value' of the expiration claim from JSON in the form of { exp, 'value' } converted to a DateTime assuming 'value' is seconds since UnixEpoch (UTC 1970-01-01T0:0:0Z). (Overrides SecurityToken.ValidTo.)

Top

Methods

  Name Description
Public method CanCreateKeyIdentifierClause<T> Gets a value that indicates whether this security token is capable of creating the specified key identifier. (Inherited from SecurityToken.)
Public method CreateKeyIdentifierClause<T> Creates the specified key identifier clause. (Inherited from SecurityToken.)
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method MatchesKeyIdentifierClause Returns a value that indicates whether the key identifier for this instance can be resolved to the specified key identifier. (Inherited from SecurityToken.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ResolveKeyIdentifierClause Gets the key for the specified key identifier clause. (Inherited from SecurityToken.)
Public method ToString Decodes the JwtHeader and JwtPayload. (Overrides Object.ToString().)

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