Exemplo n.º 1
0
        /// <summary>
        /// 处理TOKEN成用户信息
        /// <para>作    者:蔡亚康</para>
        /// <para>创建时间:2019-03-07</para>
        /// </summary>
        /// <returns></returns>
        public HssUserPrincipal Handler(HttpContext content)
        {
            HssUserPrincipal user         = null;
            string           token        = TokenProvider.GetToken(content, TOKEN_KEY);
            JwtTokenService  tokenService = new JwtTokenService();

            user = tokenService.GetUser(token);
            if (user != null)
            {
                user.IsAuthenticated = true;
            }
            else
            {
                user = new HssUserPrincipal();
                user.IsAuthenticated = false;
                user.Msg             = ErrorMsgConfig.ERROR_TOKEN_DESCRYPTION_FAILED;
            }
            return(user);
        }