JsonWebToken Constructors

Definition

Overloads

JsonWebToken(ReadOnlyMemory<Char>)

Initializes a new instance of JsonWebToken from a ReadOnlyMemory{char} in JWS or JWE Compact serialized format.

JsonWebToken(String)

Initializes a new instance of JsonWebToken from a string in JWS or JWE Compact serialized format.

JsonWebToken(String, String)

Initializes a new instance of the JsonWebToken class where the header contains the crypto algorithms applied to the encoded header and payload.

JsonWebToken(ReadOnlyMemory<Char>)

Initializes a new instance of JsonWebToken from a ReadOnlyMemory{char} in JWS or JWE Compact serialized format.

public JsonWebToken (ReadOnlyMemory<char> encodedTokenMemory);
new Microsoft.IdentityModel.JsonWebTokens.JsonWebToken : ReadOnlyMemory<char> -> Microsoft.IdentityModel.JsonWebTokens.JsonWebToken
Public Sub New (encodedTokenMemory As ReadOnlyMemory(Of Char))

Parameters

encodedTokenMemory
ReadOnlyMemory<Char>

A ReadOnlyMemory{char} containing the JSON Web Token serialized in JWS or JWE Compact format.

Exceptions

Thrown if encodedTokenMemory is empty.

Thrown if encodedTokenMemory does not represent a valid JWS or JWE Compact Serialization format.

Remarks

See: https://datatracker.ietf.org/doc/html/rfc7519 (JWT). See: https://datatracker.ietf.org/doc/html/rfc7515 (JWS). See: https://datatracker.ietf.org/doc/html/rfc7516 (JWE).

The contents of the returned JsonWebToken have not been validated; the JSON Web Token is simply decoded. Validation can be performed using the methods in JsonWebTokenHandler.

Applies to

JsonWebToken(String)

Initializes a new instance of JsonWebToken from a string in JWS or JWE Compact serialized format.

public JsonWebToken (string jwtEncodedString);
new Microsoft.IdentityModel.JsonWebTokens.JsonWebToken : string -> Microsoft.IdentityModel.JsonWebTokens.JsonWebToken
Public Sub New (jwtEncodedString As String)

Parameters

jwtEncodedString
String

A JSON Web Token that has been serialized in JWS or JWE Compact serialized format.

Exceptions

Thrown if jwtEncodedString is null or empty.

Thrown if jwtEncodedString is not in JWS or JWE Compact Serialization format.

Remarks

See: https://datatracker.ietf.org/doc/html/rfc7519 (JWT). See: https://datatracker.ietf.org/doc/html/rfc7515 (JWS). See: https://datatracker.ietf.org/doc/html/rfc7516 (JWE).

The contents of the returned JsonWebToken have not been validated, the JSON Web Token is simply decoded. Validation can be accomplished using the validation methods in JsonWebTokenHandler

Applies to

JsonWebToken(String, String)

Initializes a new instance of the JsonWebToken class where the header contains the crypto algorithms applied to the encoded header and payload.

public JsonWebToken (string header, string payload);
new Microsoft.IdentityModel.JsonWebTokens.JsonWebToken : string * string -> Microsoft.IdentityModel.JsonWebTokens.JsonWebToken
Public Sub New (header As String, payload As String)

Parameters

header
String

A string containing JSON which represents the cryptographic operations applied to the JWT and optionally any additional properties of the JWT.

payload
String

A string containing JSON which represents the claims contained in the JWT. Each claim is a JSON object of the form { Name, Value }.

Exceptions

Thrown if payload is null or empty.

Remarks

See: https://datatracker.ietf.org/doc/html/rfc7519 (JWT). See: https://datatracker.ietf.org/doc/html/rfc7515 (JWS). See: https://datatracker.ietf.org/doc/html/rfc7516 (JWE).

The contents of the returned JsonWebToken have not been validated, the JSON Web Token is simply decoded. Validation can be accomplished using the validation methods in JsonWebTokenHandler

Applies to