Пример #1
0
        public bool ValidateToken(string token, string src, string pemFile)
        {
            bool flag;

            try
            {
                RSACryptoServiceProvider rSACryptoServiceProvider = Crypto.DecodeX509PublicKey(File.ReadAllText(pemFile));
                object item = JWT.Decode <Dictionary <string, object> >(token, rSACryptoServiceProvider)["datas"];
                Console.WriteLine(string.Format(item.ToString(), new object[0]));
                flag = object.Equals(this.GetMd5(src), item);
            }
            catch (Exception exception)
            {
                LoggerAdapter.Error(string.Format("ValidateToken fail:{0}", exception.Message));
                flag = false;
            }
            return(flag);
        }
Пример #2
0
 public static T Decode <T>(string token, object key = null)
 {
     return(JWT.jsMapper.Parse <T>(JWT.Decode(token, key)));
 }
Пример #3
0
 public static T Decode <T>(string token, object key, JwsAlgorithm alg)
 {
     return(JWT.jsMapper.Parse <T>(JWT.Decode(token, key, alg)));
 }
Пример #4
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)));
 }
Пример #5
0
 public static string Decode(string token, object key = null)
 {
     return(JWT.Decode(token, key, null, null, null));
 }
Пример #6
0
        public static string Decode(string token, object key, JweAlgorithm alg, JweEncryption enc)
        {
            JwsAlgorithm?nullable = null;

            return(JWT.Decode(token, key, nullable, new JweAlgorithm?(alg), new JweEncryption?(enc)));
        }