Esempio n. 1
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var token = value as Token;
            var model = new Models.TokenModel()
            {
                Audience = token.Audience,
                Issuer   = token.Issuer,
                IssuedAt = token.CreationTime.ToEpochTime(),
                Lifetime = token.Lifetime,
                Type     = token.Type,
                Version  = token.Version
            };

            model.Claims.AddRange(token.Claims);
            serializer.Serialize(writer, model);
        }
Esempio n. 2
0
        public BaseAndroidController() : base()
        {
            //获取访问语言
            Language = GetLanguage();
            HttpRequest httpRequest = HttpContext.Current.Request;
            string      path        = httpRequest.Path;
            string      RawUrl      = httpRequest.RawUrl;

            TraceEx.Write(SysMessageLevel.SysReceiveInfo, string.Format("访问路径:{0}", RawUrl));
            if (!NoTokenUrl.Contains(path.ToLower()))
            {
                tokenModel = CheckAndGetToken();
                HttpContext.Current.Request.Headers.Add("TokenStatus", tokenModel.CheckResult.ToString());
            }
            else
            {
                HttpContext.Current.Request.Headers.Add("TokenStatus", CheckToken_Success.ToString());
            }
        }