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

System.IdentityModel.Tokens.Jwt.JwtPayload

public class JwtPayload : Dictionary<string, object>
Initializes a new instance of JwtPayload which contains JSON objects representing the claims contained in the JWT. Each claim is a JSON object of the form { Name, Value }.
public string Acr { get; }

Gets the 'value' of the 'acr' claim { acr, 'value' }.

public string Actort { get; }

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

public IList<string> Amr { get; }

Gets the 'value' of the 'amr' claim { amr, 'value' } as list of strings.

public IList<string> Aud { get; }

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

public int? AuthTime { get; }

Gets the 'value' of the 'auth_time' claim { auth_time, 'value' }.

public string Azp { get; }

Gets the 'value' of the 'azp' claim { azp, 'value' }.

public string CHash { get; }

Gets 'value' of the 'c_hash' claim { c_hash, 'value' }.

public virtual IEnumerable<Claim> Claims { get; }

Gets a IEnumerable<T> Claim for each JSON { name, value }.

public int? Exp { get; }

Gets the 'value' of the 'expiration' claim { exp, 'value' }.

public long? Expiration { get; }

Gets the 'value' of the 'expiration' claim { exp, 'value' }.

public int? Iat { get; }

Gets the 'value' of the 'Issued At' claim { iat, 'value' }.

public string Iss { get; }

Gets the 'value' of the 'issuer' claim { iss, 'value' }.

public 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 string Jti { get; }

Gets the 'value' of the 'JWT ID' claim { jti, 'value' }.

public int? Nbf { get; }

Gets the 'value' of the 'expiration' claim { nbf, 'value' }.

public string Nonce { get; }

Gets the 'value' of the 'nonce' claim { nonce, 'value' }.

public long? NotBefore { get; }

Gets the 'value' of the 'notebefore' claim { nbf, 'value' }.

public string Sub { get; }

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

public DateTime ValidFrom { get; }

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

public DateTime ValidTo { get; }

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

public JwtPayload()

Initializes a new instance of the JwtPayload class with no claims. Default string comparer Ordinal. Creates a empty JwtPayload

public JwtPayload(IEnumerable<Claim> claims)

Initializes a new instance of the JwtPayload class with IEnumerable<T>. Default string comparer Ordinal. The claims to add.

public JwtPayload(string issuer, string audience, IEnumerable<Claim> claims, DateTime? notBefore, DateTime? expires)

Initializes a new instance of the JwtPayload class with claims added for each parameter specified. Default string comparer Ordinal.

public JwtPayload(string issuer, string audience, IEnumerable<Claim> claims, DateTime? notBefore, DateTime? expires, DateTime? issuedAt)

Initializes a new instance of the JwtPayload class with claims added for each parameter specified. Default string comparer Ordinal.

public JwtPayload(string issuer, IList<string> audiences, IEnumerable<Claim> claims, IDictionary<string, object> claimsCollection, DateTime? notBefore, DateTime? expires, DateTime? issuedAt)

Initializes a new instance of the JwtPayload class with claims added for each parameter specified. Default string comparer Ordinal.

public JwtPayload(string issuer, string audience, IList<string> audiences, IEnumerable<Claim> claims, IDictionary<string, object> claimsCollection, DateTime? notBefore, DateTime? expires, DateTime? issuedAt)

Initializes a new instance of the JwtPayload class with claims added for each parameter specified. Default string comparer Ordinal.

public JwtPayload(string issuer, string audience, IEnumerable<Claim> claims, IDictionary<string, object> claimsCollection, DateTime? notBefore, DateTime? expires, DateTime? issuedAt)

Initializes a new instance of the JwtPayload class with claims added for each parameter specified. Default string comparer Ordinal.

public static JwtPayload Base64UrlDeserialize(string base64UrlEncodedJsonString)

Deserializes Base64UrlEncoded JSON into a JwtPayload.

public static JwtPayload Deserialize(string jsonString)

Deserialzes JSON into a JwtPayload instance.

public void AddClaim(Claim claim)

Adds a JSON object representing the Claim to the JwtPayload

public void AddClaims(IEnumerable<Claim> claims)

Adds a number of Claim to the JwtPayload as JSON { name, value } pairs.

public virtual string Base64UrlEncode()

Encodes this instance as Base64UrlEncoded JSON.

public virtual string SerializeToJson()

Serializes this instance to JSON.