Ejemplo n.º 1
0
        public string Login(string email, string password)
        {
            password = password.EnsureNotNullOrWhiteSpace(nameof(password));

            var user         = Get(email);
            var passwordHash = CryptoHash.Pbkdf2Hash(password, user.PasswordSalt.ParseBase64String()).GetBase64String();

            if (passwordHash.IsOrdinalEqual(user.PasswordHash, true))
            {
                return(JwtService.GenerateToken(user));
            }
            else
            {
                throw new BusinessException("Email or password is not correct.");
            }
        }
Ejemplo n.º 2
0
 public void Logout(string session)
 {
     JwtService.RemoveSession(session);
 }