Class JwtEncoder
- Namespace
- JWT
- Assembly
- Coherence.JWT.dll
Encodes Jwt.
public sealed class JwtEncoder : IJwtEncoder
- Inheritance
-
JwtEncoder
- Implements
- Extension Methods
Constructors
JwtEncoder(IAlgorithmFactory, IJsonSerializer, IBase64UrlEncoder)
Creates an instance of JwtEncoder
public JwtEncoder(IAlgorithmFactory algFactory, IJsonSerializer jsonSerializer, IBase64UrlEncoder urlEncoder)
Parameters
algFactoryIAlgorithmFactoryThe JWT algorithm factory
jsonSerializerIJsonSerializerThe JSON serializer
urlEncoderIBase64UrlEncoderThe base64 URL encoder
JwtEncoder(IJwtAlgorithm, IJsonSerializer, IBase64UrlEncoder)
Creates an instance of JwtEncoder
public JwtEncoder(IJwtAlgorithm algorithm, IJsonSerializer jsonSerializer, IBase64UrlEncoder urlEncoder)
Parameters
algorithmIJwtAlgorithmThe JWT algorithm
jsonSerializerIJsonSerializerThe JSON serializer
urlEncoderIBase64UrlEncoderThe base64 URL encoder
Methods
Encode(IDictionary<string, object>, object, byte[])
Creates a JWT given a header, a payload, the signing key, and the algorithm to use.
public string Encode(IDictionary<string, object> extraHeaders, object payload, byte[] key)
Parameters
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)
keybyte[]The key bytes used to sign the token
Returns
- string
The generated JWT