Exemplo n.º 1
0
        public bool TryAuthenticate(string userName, string password, out IUserAuth userAuth)
        {
            userAuth = GetUserAuthByUserName(userName);
            if (userAuth == null)
            {
                return(false);
            }

            if (userAuth.VerifyPassword(password, out var needsRehash))
            {
                this.RecordSuccessfulLogin(userAuth, needsRehash, password);
                return(true);
            }

            this.RecordInvalidLoginAttempt(userAuth);
            userAuth = null;
            return(false);
        }