Table of Contents

Class JwtDecoderExtensions

Namespace
JWT
Assembly
Coherence.JWT.dll

Extension methods for IJwtDecoder>

public static class JwtDecoderExtensions
Inheritance
JwtDecoderExtensions

Methods

Decode(IJwtDecoder, string, bool)

Given a JWT, decodes it and return the payload.

public static string Decode(this IJwtDecoder decoder, string token, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

verify bool

Whether to verify the signature (default is true)

Returns

string

A string containing the JSON payload

Exceptions

ArgumentException
ArgumentOutOfRangeException
InvalidTokenPartsException

Decode(IJwtDecoder, string, byte[], bool)

Given a JWT, decodes it, and return the payload.

public static string Decode(this IJwtDecoder decoder, string token, byte[] key, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

key byte[]

The key that was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

string

A string containing the JSON payload

Exceptions

ArgumentException
ArgumentOutOfRangeException
InvalidTokenPartsException

Decode(IJwtDecoder, string, byte[][], bool)

Given a JWT, decodes it, and return the payload.

public static string Decode(this IJwtDecoder decoder, string token, byte[][] keys, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

keys byte[][]

The keys that were used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

string

A string containing the JSON payload

Exceptions

ArgumentException
ArgumentOutOfRangeException
InvalidTokenPartsException

Decode(IJwtDecoder, string, string, bool)

Given a JWT, decodes it, and return the payload as an dictionary.

public static string Decode(this IJwtDecoder decoder, string token, string key, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

key string

The key that was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

string

An object representing the payload

Exceptions

ArgumentException
ArgumentOutOfRangeException

Decode(IJwtDecoder, string, string[], bool)

Given a JWT, decodes it, and return the payload as an dictionary.

public static string Decode(this IJwtDecoder decoder, string token, string[] keys, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

keys string[]

The key which one of them was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

string

An object representing the payload

Exceptions

ArgumentException
ArgumentOutOfRangeException

DecodeHeaderToDictionary(IJwtDecoder, string)

public static IDictionary<string, string> DecodeHeaderToDictionary(this IJwtDecoder decoder, string token)

Parameters

decoder IJwtDecoder
token string

Returns

IDictionary<string, string>

DecodeHeader<T>(IJwtDecoder, string)

public static T DecodeHeader<T>(this IJwtDecoder decoder, string token)

Parameters

decoder IJwtDecoder
token string

Returns

T

Type Parameters

T

DecodeToObject(IJwtDecoder, string, bool)

Given a JWT, decodes it and return the payload as a dictionary.

public static IDictionary<string, object> DecodeToObject(this IJwtDecoder decoder, string token, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

verify bool

Whether to verify the signature (default is true)

Returns

IDictionary<string, object>

An object representing the payload

DecodeToObject(IJwtDecoder, string, byte[], bool)

Given a JWT, decodes it and return the payload as a dictionary.

public static IDictionary<string, object> DecodeToObject(this IJwtDecoder decoder, string token, byte[] key, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

key byte[]

The key that was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

IDictionary<string, object>

An object representing the payload

Exceptions

ArgumentException
ArgumentOutOfRangeException
InvalidTokenPartsException

DecodeToObject(IJwtDecoder, string, byte[][], bool)

Given a JWT, decodes it and return the payload as a dictionary.

public static IDictionary<string, object> DecodeToObject(this IJwtDecoder decoder, string token, byte[][] keys, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

keys byte[][]

The keys that were used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

IDictionary<string, object>

A string containing the JSON payload

Exceptions

ArgumentException
ArgumentOutOfRangeException
InvalidTokenPartsException

DecodeToObject(IJwtDecoder, string, string, bool)

Given a JWT, decodes it and return the payload as a dictionary.

public static IDictionary<string, object> DecodeToObject(this IJwtDecoder decoder, string token, string key, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

key string

The key that was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

IDictionary<string, object>

An object representing the payload

DecodeToObject(IJwtDecoder, string, string[], bool)

Given a JWT, decodes it and return the payload as a dictionary.

public static IDictionary<string, object> DecodeToObject(this IJwtDecoder decoder, string token, string[] keys, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

keys string[]

The keys provided which one of them was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

IDictionary<string, object>

An object representing the payload

DecodeToObject(IJwtDecoder, Type, string, byte[], bool)

Given a JWT, decodes it and return the payload as a dictionary.

public static object DecodeToObject(this IJwtDecoder decoder, Type type, string token, byte[] key, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

type Type

The type to deserialize to.

token string

The JWT

key byte[]

The key that was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

object

An object representing the payload

Exceptions

ArgumentException
ArgumentOutOfRangeException
InvalidTokenPartsException

DecodeToObject(IJwtDecoder, Type, string, byte[][], bool)

Given a JWT, decodes it and return the payload as a dictionary.

public static object DecodeToObject(this IJwtDecoder decoder, Type type, string token, byte[][] keys, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

type Type

The type to deserialize to.

token string

The JWT

keys byte[][]

The keys that were used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

object

A string containing the JSON payload

Exceptions

ArgumentException
ArgumentOutOfRangeException
InvalidTokenPartsException

DecodeToObject(IJwtDecoder, Type, string, string, bool)

Given a JWT, decodes it and return the payload as an dictionary.

public static object DecodeToObject(this IJwtDecoder decoder, Type type, string token, string key, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

type Type

The type to deserialize to.

token string

The JWT

key string

The key that was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

object

An object representing the payload

Exceptions

ArgumentException
ArgumentOutOfRangeException

DecodeToObject(IJwtDecoder, Type, string, string[], bool)

Given a JWT, decodes it and return the payload as an dictionary.

public static object DecodeToObject(this IJwtDecoder decoder, Type type, string token, string[] keys, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

type Type

The type to deserialize to.

token string

The JWT

keys string[]

The key which one of them was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

object

An object representing the payload

Exceptions

ArgumentException
ArgumentOutOfRangeException

DecodeToObject<T>(IJwtDecoder, JwtParts, bool)

Given a JWT, decodes it and return the payload as an object.

public static T DecodeToObject<T>(this IJwtDecoder decoder, JwtParts jwt, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

jwt JwtParts

The JWT

verify bool

Whether to verify the signature (default is true)

Returns

T

An object representing the payload

Type Parameters

T

The type to deserialize to.

DecodeToObject<T>(IJwtDecoder, JwtParts, byte[], bool)

Given a JWT, decodes it and return the payload as an object.

public static T DecodeToObject<T>(this IJwtDecoder decoder, JwtParts jwt, byte[] key, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

jwt JwtParts

The JWT

key byte[]

The key that was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

T

An object representing the payload

Type Parameters

T

The type to deserialize to.

DecodeToObject<T>(IJwtDecoder, JwtParts, byte[][], bool)

Given a JWT, decodes it and return the payload as an object.

public static T DecodeToObject<T>(this IJwtDecoder decoder, JwtParts jwt, byte[][] keys, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

jwt JwtParts

The JWT

keys byte[][]

The keys which one of them was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

T

An object representing the payload

Type Parameters

T

The type to deserialize to.

DecodeToObject<T>(IJwtDecoder, string)

Given a JWT, decodes it and return the payload as an object.

public static T DecodeToObject<T>(this IJwtDecoder decoder, string token)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

Returns

T

An object representing the payload

Type Parameters

T

The type to return

DecodeToObject<T>(IJwtDecoder, string, byte[], bool)

Given a JWT, decodes it and return the payload as an object.

public static T DecodeToObject<T>(this IJwtDecoder decoder, string token, byte[] key, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

key byte[]

The key that was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

T

An object representing the payload

Type Parameters

T

The type to return

DecodeToObject<T>(IJwtDecoder, string, byte[][], bool)

Given a JWT, decodes it and return the payload as an object.

public static T DecodeToObject<T>(this IJwtDecoder decoder, string token, byte[][] keys, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

keys byte[][]

The keys provided which one of them was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

T

An object representing the payload

Type Parameters

T

The type to return

DecodeToObject<T>(IJwtDecoder, string, string, bool)

Given a JWT, decodes it and return the payload as an object.

public static T DecodeToObject<T>(this IJwtDecoder decoder, string token, string key, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

key string

The key that was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

T

An object representing the payload

Type Parameters

T

The type to return

DecodeToObject<T>(IJwtDecoder, string, string[], bool)

Given a JWT, decodes it and return the payload as an object.

public static T DecodeToObject<T>(this IJwtDecoder decoder, string token, string[] keys, bool verify = true)

Parameters

decoder IJwtDecoder

The decoder instance

token string

The JWT

keys string[]

The keys provided which one of them was used to sign the JWT

verify bool

Whether to verify the signature (default is true)

Returns

T

An object representing the payload

Type Parameters

T

The type to return