<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.15.0" />

System.IdentityModel.Tokens.Jwt.JwtSecurityToken

public class JwtSecurityToken : SecurityToken
A SecurityToken designed for representing a JSON Web Token (JWT).
public string Actor { get; }

Gets the 'value' of the 'actor' claim { actort, 'value' }.

public IEnumerable<string> Audiences { get; }

Gets the list of 'audience' claim { aud, 'value' }.

public IEnumerable<Claim> Claims { get; }

Gets the Claim(s) for this token. If this is a JWE token, this property only returns the encrypted claims; the unencrypted claims should be read from the header seperately.

public virtual string EncodedHeader { get; }

Gets the Base64UrlEncoded JwtHeader associated with this instance.

public virtual string EncodedPayload { get; }

Gets the Base64UrlEncoded JwtPayload associated with this instance.

public EncryptingCredentials EncryptingCredentials { get; }

Gets the EncryptingCredentials to use when writing this token.

public JwtHeader Header { get; }

Gets the JwtHeader associated with this instance if the token is signed.

public JwtSecurityToken InnerToken { get; }

Gets the JwtSecurityToken associated with this instance.

public virtual DateTime IssuedAt { get; }

Gets the 'value' of the 'issued at' claim { iat, 'value' } converted to a DateTime assuming 'value' is seconds since UnixEpoch (UTC 1970-01-01T0:0:0Z).

public JwtPayload Payload { get; }

Gets the JwtPayload associated with this instance. Note that if this JWT is nested ( InnerToken != null, this property represents the payload of the most inner token. This property can be null if the content type of the most inner token is unrecognized, in that case the content of the token is the string returned by PlainText property.

public string RawAuthenticationTag { get; }

Gets the original raw data of this instance when it was created.

public string RawCiphertext { get; }

Gets the original raw data of this instance when it was created.

public string RawData { get; }

Gets the original raw data of this instance when it was created.

public string RawEncryptedKey { get; }

Gets the original raw data of this instance when it was created.

public string RawHeader { get; }

Gets the original raw data of this instance when it was created.

public string RawInitializationVector { get; }

Gets the original raw data of this instance when it was created.

public string RawPayload { get; }

Gets the original raw data of this instance when it was created.

public string RawSignature { get; }

Gets the original raw data of this instance when it was created.

public string SignatureAlgorithm { get; }

Gets the signature algorithm associated with this instance.

public SigningCredentials SigningCredentials { get; }

Gets the SigningCredentials to use when writing this token.

public string Subject { get; }

Gets the "value" of the 'subject' claim { sub, 'value' }.

public JwtSecurityToken(string jwtEncodedString)

Initializes a new instance of JwtSecurityToken from a string in JWS Compact serialized format.

public JwtSecurityToken(JwtHeader header, JwtPayload payload, string rawHeader, string rawPayload, string rawSignature)

Initializes a new instance of the JwtSecurityToken class where the JwtHeader contains the crypto algorithms applied to the encoded JwtHeader and JwtPayload. The jwtEncodedString is the result of those operations.

public JwtSecurityToken(JwtHeader header, JwtSecurityToken innerToken, string rawHeader, string rawEncryptedKey, string rawInitializationVector, string rawCiphertext, string rawAuthenticationTag)

Initializes an instance of JwtSecurityToken where the JwtHeader contains the crypto algorithms applied to the innerToken JwtSecurityToken.

public JwtSecurityToken(JwtHeader header, JwtPayload payload)

Initializes a new instance of the JwtSecurityToken class where the JwtHeader contains the crypto algorithms applied to the encoded JwtHeader and JwtPayload. The jwtEncodedString is the result of those operations.

public JwtSecurityToken(string issuer = null, string audience = null, IEnumerable<Claim> claims = null, DateTime? notBefore = default, DateTime? expires = default, SigningCredentials signingCredentials = null)

Initializes a new instance of the JwtSecurityToken class specifying optional parameters.