Exemplo n.º 1
0
 public static IDictionary <string, object> Headers(string token)
 {
     return(JWT.Headers <IDictionary <string, object> >(token));
 }
Exemplo n.º 2
0
 public static T Payload <T>(string token)
 {
     return(JWT.jsMapper.Parse <T>(JWT.Payload(token)));
 }
Exemplo n.º 3
0
 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));
 }
Exemplo n.º 4
0
 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));
 }
Exemplo n.º 5
0
 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));
 }
Exemplo n.º 6
0
 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));
 }
Exemplo n.º 7
0
        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)));
        }
Exemplo n.º 8
0
 public static byte[] DecodeBytes(string token, object key = null)
 {
     return(JWT.DecodeBytes(token, key, null, null, null));
 }
Exemplo n.º 9
0
 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));
 }
Exemplo n.º 10
0
 public static T Decode <T>(string token, object key = null)
 {
     return(JWT.jsMapper.Parse <T>(JWT.Decode(token, key)));
 }
Exemplo n.º 11
0
 public static T Decode <T>(string token, object key, JwsAlgorithm alg)
 {
     return(JWT.jsMapper.Parse <T>(JWT.Decode(token, key, alg)));
 }
Exemplo n.º 12
0
 public static T Decode <T>(string token, object key, JweAlgorithm alg, JweEncryption enc)
 {
     return(JWT.jsMapper.Parse <T>(JWT.Decode(token, key, alg, enc)));
 }
Exemplo n.º 13
0
 public static string Decode(string token, object key = null)
 {
     return(JWT.Decode(token, key, null, null, null));
 }