public AuthenticateResponse Login(string username, string password) { var user = _storage.GetByUsername(username); var hashedPassword = PasswordUtils.HashPassword(user.Salt, password); if (hashedPassword == user.HashedPassword) { var token = generateJwtToken(user); return(new AuthenticateResponse(user, token)); } else { throw new NotFoundException($"Invalid username / password."); } }