示例#1
0
        public virtual bool TryAuthenticate(Dictionary <string, string> digestHeaders, string privateKey, int nonceTimeOut, string sequence, out IUserAuth userAuth)
        {
            userAuth = GetUserAuthByUserName(digestHeaders["username"]);
            if (userAuth == null)
            {
                return(false);
            }

            if (userAuth.VerifyDigestAuth(digestHeaders, privateKey, nonceTimeOut, sequence))
            {
                this.RecordSuccessfulLogin(userAuth);
                return(true);
            }

            this.RecordInvalidLoginAttempt(userAuth);

            userAuth = null;
            return(false);
        }