示例#1
0
        public void Password_Can_Be_Hashed_And_Verified()
        {
            var correctPassword   = "******";
            var incorrectPassword = "******";

            var hashedPassword = _service.GetHashedPassword(correctPassword);

            Assert.IsTrue(_service.Verify(correctPassword, hashedPassword));
            Assert.IsFalse(_service.Verify(correctPassword, incorrectPassword));
        }
示例#2
0
 public User GetByCredentials(string username, string inputPassword)
 {
     return(Query().Where(u => u.Username == username)
            .AsEnumerable()
            .Where(u => PasswordHashService.Verify(inputPassword, u.Password)).FirstOrDefault());
 }