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
IJwtEncoderThe encoder instance
extraHeaders
IDictionary<string, object>An arbitrary set of extra headers. Will be augmented with the standard "typ" and "alg" headers
payload
objectAn arbitrary payload (must be serializable to JSON)
key
stringThe key bytes used to sign the token
Returns
- string
The generated JWT
Exceptions
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
IJwtEncoderThe encoder instance
payload
objectAn arbitrary payload (must be serializable to JSON)
key
byte[]The key used to sign the token
Returns
- string
The generated JWT
Exceptions
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
IJwtEncoderThe encoder instance
payload
objectAn arbitrary payload (must be serializable to JSON)
key
stringThe key used to sign the token
Returns
- string
The generated JWT