public async Task <UserInfoQueryResponse> Handle(UserInfoQuery request, CancellationToken cancellationToken)
        {
            /* Just for testing only**/
            var result = await _identity.FindUserByIdAsync(request.UserId);

            return(result != null?_mapper.Map <User, UserInfoQueryResponse>(result) : new UserInfoQueryResponse());
        }
示例#2
0
        public async Task <AuthenticationResponse> LoginAsync(LoginCommand user)
        {
            var existingUser = await _identity.FindUserByIdAsync(user.UserId);

            if (existingUser == null)
            {
                return(new AuthenticationResponse
                {
                    Errors = new[] { "Username / password incorrect" }
                });
            }

            if (CheckPasswordAsync(existingUser.Password, existingUser.Salt, user.Password))
            {
                return(new AuthenticationResponse
                {
                    Errors = new[] { "Username / password incorrect" }
                });
            }

            return(await GenerateAuthenticationResponseForUserAsync(existingUser));
        }