예제 #1
0
        public Task HandleAsync(RegisterUserCommand command)
        {
            var salt         = encypterService.GetSalt(command.Password);
            var passwordHash = encypterService.GetHash(command.Password, salt);
            var user         = mapper.Map <UserEntity>(command);

            user.Salt     = salt;
            user.Password = passwordHash;

            return(userRepository.AddAsync(user));
        }
예제 #2
0
        public async Task <bool> AuthenticateUserAsync(AuthenticateUserDto credentials)
        {
            var user = await userRepository.GetByUserName(credentials.UserName);

            return(user != null && encypterService.GetHash(credentials.Password, user.Salt) == user.Password ? true : false);
        }