Commit fdb7fc8f authored by 黄奎's avatar 黄奎

页面修改

parent 9185416c
......@@ -102,7 +102,7 @@ namespace Edu.WebApi.Filter
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, string.Format("DoApiMonitorLog:{0}", responseData));
Common.Plugin.LogHelper.Write(ex, string.Format("DoApiMonitorLog:{0}", responseData));
}
token = headers["token"].ToString();
}
......
......@@ -16,8 +16,8 @@ namespace Edu.WebApi.Helper
/// <summary>
/// 生成Token
/// </summary>
/// <param name="uid"></param>
/// <param name="requestFromEnum"></param>
/// <param name="uid">加密字符串</param>
/// <param name="requestFromEnum">来源</param>
/// <returns></returns>
public static string CreateToken(string uid, Common.Enum.ApiRequestFromEnum requestFromEnum)
{
......@@ -26,12 +26,12 @@ namespace Edu.WebApi.Helper
var now = provider.GetNow().AddMinutes(-1);
var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
var secondsSinceEpoch = Math.Round((now - unixEpoch).TotalSeconds);
var payload = new Dictionary<string, object>
{
{"iat",secondsSinceEpoch },
{"exp",secondsSinceEpoch+Common.Config.JwtExpirTime},
{Common.GlobalKey.JWT_User_Key,userInfo }
};
var payload = new Dictionary<string, object>()
{
{"iat",secondsSinceEpoch },
{"exp",secondsSinceEpoch+Common.Config.JwtExpirTime},
{Common.GlobalKey.JWT_User_Key,userInfo }
};
IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
IJsonSerializer serializer = new JsonNetSerializer();
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
......@@ -54,7 +54,8 @@ namespace Edu.WebApi.Helper
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
IJwtDecoder decoder = new JwtDecoder(serializer, validator, urlEncoder);
string secret = Common.Config.JwtSecretKey;
var json = decoder.Decode(token, secret, verify: true);//token为之前生成的字符串
//token为之前生成的字符串
var json = decoder.Decode(token, secret, verify: true);
JObject jwtJson = JObject.Parse(json);
return jwtJson;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment