public void TestKeyIncode() { ClientTokens _tokens = new ClientTokens(ClientIdentityKey.GetClientKeys(), ClientIdentityKey.GetClientTokenKeys()); var keyValue = "7DaEvpzZxw48Wtf3rS/B21UBZnUcCcRu"; var _curtoken = _tokens.KeyEnCode(keyValue); var isExprise = _tokens.CheckClientToken(_curtoken); Assert.AreEqual(true, isExprise); }
/// <summary> /// 获取客户端token /// </summary> /// <param name="context"></param> private void Ajax_GetClientToken(HttpContext context) { string clientKey = "clientkey".GetUrlString(); string token = new ClientTokens( ClientIdentityKey.GetClientKeys(), ClientIdentityKey.GetClientTokenKeys() ).KeyEnCode(clientKey); context.Response.Write(new { code = 200, msg = "^_^ Request Success !", data = token }.DocumentsToJson()); }
private void InitTokens() { _tokens = ClientIdentityKey.GetClientKeys(); _tokenKeys = ClientIdentityKey.GetClientTokenKeys(); ClientTokenTool = new ClientTokens(_tokens, _tokenKeys); }