public static IDictionary <string, object> Headers(string token) { return(JWT.Headers <IDictionary <string, object> >(token)); }
public static T Payload <T>(string token) { return(JWT.jsMapper.Parse <T>(JWT.Payload(token))); }
public static string Encode(object payload, object key, JwsAlgorithm algorithm, IDictionary <string, object> extraHeaders = null) { return(JWT.Encode(JWT.jsMapper.Serialize(payload), key, algorithm, extraHeaders)); }
public static string Encode(string payload, object key, JwsAlgorithm algorithm, IDictionary <string, object> extraHeaders = null) { Ensure.IsNotEmpty(payload, "Payload expected to be not empty, whitespace or null.", new object[0]); return(JWT.EncodeBytes(Encoding.UTF8.GetBytes(payload), key, algorithm, extraHeaders)); }
private static string Decrypt(byte[][] parts, object key, JweAlgorithm?jweAlg, JweEncryption?jweEnc) { byte[] numArray = JWT.DecryptBytes(parts, key, jweAlg, jweEnc); return(Encoding.UTF8.GetString(numArray)); }
public static string Encode(object payload, object key, JweAlgorithm alg, JweEncryption enc, JweCompression?compression = null, IDictionary <string, object> extraHeaders = null) { return(JWT.Encode(JWT.jsMapper.Serialize(payload), key, alg, enc, compression, extraHeaders)); }
public static byte[] DecodeBytes(string token, object key, JweAlgorithm alg, JweEncryption enc) { JwsAlgorithm?nullable = null; return(JWT.DecodeBytes(token, key, nullable, new JweAlgorithm?(alg), new JweEncryption?(enc))); }
public static byte[] DecodeBytes(string token, object key = null) { return(JWT.DecodeBytes(token, key, null, null, null)); }
private static string Decode(string token, object key = null, JwsAlgorithm?jwsAlg = null, JweAlgorithm?jweAlg = null, JweEncryption?jweEnc = null) { byte[] numArray = JWT.DecodeBytes(token, key, jwsAlg, jweAlg, jweEnc); return(Encoding.UTF8.GetString(numArray)); }
public static T Decode <T>(string token, object key = null) { return(JWT.jsMapper.Parse <T>(JWT.Decode(token, key))); }
public static T Decode <T>(string token, object key, JwsAlgorithm alg) { return(JWT.jsMapper.Parse <T>(JWT.Decode(token, key, alg))); }
public static T Decode <T>(string token, object key, JweAlgorithm alg, JweEncryption enc) { return(JWT.jsMapper.Parse <T>(JWT.Decode(token, key, alg, enc))); }
public static string Decode(string token, object key = null) { return(JWT.Decode(token, key, null, null, null)); }