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); }
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)); }
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))); }