Account.Filters.CustomAuthenticationFilter.AuthenticateAsync C# (CSharp) Method

AuthenticateAsync() private method

private AuthenticateAsync ( HttpRequestMessage request ) : Task
request System.Net.Http.HttpRequestMessage
return Task
        private Task<IPrincipal> AuthenticateAsync(HttpRequestMessage request)
        {
            //return Task.Run<IPrincipal>(() =>
            //    {
            //        CookieHeaderValue cookieMobile = request.Headers.GetCookies("clientMobile").FirstOrDefault(),
            //            cookieToken = request.Headers.GetCookies("clientToken").FirstOrDefault();
            //        if (cookieMobile == null || cookieToken == null
            //            || string.IsNullOrWhiteSpace(cookieMobile["clientMobile"].Value)
            //            || string.IsNullOrWhiteSpace(cookieToken["clientToken"].Value))
            //        {
            //            return null;
            //        }

            //        string mobile = cookieMobile["clientMobile"].Value,
            //            token = cookieToken["clientToken"].Value;
            //        ClientDTO client = null;
            //        using (ICache cache = ObjectContainer.Current.Resolve<ICacheFactory>().CreateCache())
            //        {
            //            client = cache.Get<ClientDTO>(RedisTables.CLIENT, mobile);
            //        }
            //        if (client != null && string.Equals(token, Md5Helper.MD5(string.Format("{0}{1}", mobile, client.MsgCode), 32), StringComparison.Ordinal))
            //        {
            //            IEnumerable<Claim> claims = new List<Claim>()
            //            {
            //                new Claim(ClaimTypes.Name, mobile)
            //            };
            //            var identity = new ClaimsIdentity("LoanCookie");
            //            identity.AddClaims(claims);
            //            return new ClaimsPrincipal(identity);
            //        }

            //        return null;
            //    });

            var tcs = new TaskCompletionSource<IPrincipal>();
            tcs.SetResult(null);

            return tcs.Task;
        }
    }

Same methods

CustomAuthenticationFilter::AuthenticateAsync ( System.Web.Http.Filters.HttpAuthenticationContext context, CancellationToken cancellationToken ) : Task
CustomAuthenticationFilter