コード例 #1
0
        /// <summary>
        /// 读取
        /// </summary>
        /// <returns>数据</returns>
        public ReturnInfo <UserT> Reader()
        {
            ReturnInfo <UserT> returnInfo       = new ReturnInfo <UserT>();
            ReturnInfo <bool>  isAuthReturnInfo = IsAuthed();

            if (isAuthReturnInfo.Success() && isAuthReturnInfo.Data)
            {
                var claims = httpContext.HttpContext.User.Claims;
                if (claims == null)
                {
                    return(returnInfo);
                }

                returnInfo.Data = IdentityAuthUtil.GetUserDataFromClaims <IdT, UserT>(claims, authUserData);
            }

            return(returnInfo);
        }
コード例 #2
0
        /// <summary>
        /// 读取
        /// </summary>
        /// <param name="context">上下文</param>
        /// <returns>数据</returns>
        public ReturnInfo <UserT> Reader(HttpContext context)
        {
            var returnInfo       = new ReturnInfo <UserT>();
            var isAuthReturnInfo = IsAuthed(context);

            if (isAuthReturnInfo.Success() && isAuthReturnInfo.Data)
            {
                var claims = context.User.Claims;
                if (claims == null)
                {
                    return(returnInfo);
                }

                if (authUserData != null)
                {
                    returnInfo.Data = IdentityAuthUtil.GetUserDataFromClaims <IdT, UserT>(claims, authUserData);
                }
            }

            return(returnInfo);
        }