Exemple #1
0
        private bool TryToAuthenticate(HttpRequestMessage request, int portalId)
        {
            if (request.Headers.Authorization == null)
            {
                return(false);
            }

            string authHeader = request.Headers.Authorization.ToString();

            var digestAuthentication = new DigestAuthentication(new DigestAuthenticationRequest(authHeader, request.Method.Method), portalId, request.GetIPAddress());

            if (digestAuthentication.IsValid)
            {
                SetCurrentPrincipal(digestAuthentication.User, request);
            }
            else if (digestAuthentication.IsNonceStale)
            {
                return(true);
            }

            return(false);
        }
        private bool TryToAuthenticate(HttpRequestMessage request, int portalId)
        {
            if (request.Headers.Authorization == null)
            {
                return false;
            }

            string authHeader = request.Headers.Authorization.ToString();

            var digestAuthentication = new DigestAuthentication(new DigestAuthenticationRequest(authHeader, request.Method.Method), portalId, request.GetIPAddress());

            if (digestAuthentication.IsValid)
            {
                SetCurrentPrincipal(digestAuthentication.User, request);
            }
            else if(digestAuthentication.IsNonceStale)
            {
                return true;
            }

            return false;
        }