Table of Contents

Class JwtEncoderExtensions

Namespace
JWT
Assembly
Coherence.JWT.dll

Extension methods for IJwtEncoder

public static class JwtEncoderExtensions
Inheritance
JwtEncoderExtensions

Methods

Encode(IJwtEncoder, IDictionary<string, object>, object, string)

Creates a JWT given a set of arbitrary extra headers, a payload, the signing key, and the algorithm to use.

public static string Encode(this IJwtEncoder encoder, IDictionary<string, object> extraHeaders, object payload, string key)

Parameters

encoder IJwtEncoder

The encoder instance

extraHeaders IDictionary<string, object>

An arbitrary set of extra headers. Will be augmented with the standard "typ" and "alg" headers

payload object

An arbitrary payload (must be serializable to JSON)

key string

The key bytes used to sign the token

Returns

string

The generated JWT

Exceptions

ArgumentNullException

Encode(IJwtEncoder, object, byte[])

Creates a JWT given a payload, the signing key, and the algorithm to use.

public static string Encode(this IJwtEncoder encoder, object payload, byte[] key)

Parameters

encoder IJwtEncoder

The encoder instance

payload object

An arbitrary payload (must be serializable to JSON)

key byte[]

The key used to sign the token

Returns

string

The generated JWT

Exceptions

ArgumentNullException

Encode(IJwtEncoder, object, string)

Creates a JWT given a payload, the signing key, and the algorithm to use.

public static string Encode(this IJwtEncoder encoder, object payload, string key)

Parameters

encoder IJwtEncoder

The encoder instance

payload object

An arbitrary payload (must be serializable to JSON)

key string

The key used to sign the token

Returns

string

The generated JWT

Exceptions

ArgumentNullException