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
encoderIJwtEncoderThe encoder instance
extraHeadersIDictionary<string, object>An arbitrary set of extra headers. Will be augmented with the standard "typ" and "alg" headers
payloadobjectAn arbitrary payload (must be serializable to JSON)
keystringThe 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
encoderIJwtEncoderThe encoder instance
payloadobjectAn arbitrary payload (must be serializable to JSON)
keybyte[]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
encoderIJwtEncoderThe encoder instance
payloadobjectAn arbitrary payload (must be serializable to JSON)
keystringThe key used to sign the token
Returns
- string
The generated JWT