/// <summary> /// Initializes a new instance of the JwtModel class. /// </summary> /// <param name="payload">The payload.</param> /// <param name="sign">The signature provider.</param> public JsonWebToken(T payload, ISignatureProvider sign) { Payload = payload; signature = sign; header = sign != null ? new JsonWebTokenHeader { AlgorithmName = sign.Name } : JsonWebTokenHeader.NoAlgorithm; }
/// <summary> /// Refreshs the cache. /// </summary> private void Refresh() { headerCache = WebFormat.Base64UrlDecodeTo <JsonWebTokenHeader>(HeaderBase64Url) ?? JsonWebTokenHeader.NoAlgorithm; payloadCache = WebFormat.Base64UrlDecodeTo <T>(PayloadBase64Url); }