Esempio n. 1
0
        public async Task <AuthenticateResponse> AuthenticateAdvertiser(AuthenticateRequest request)
        {
            var errors = request.Validate();

            if (errors.Any())
            {
                throw new ValidationException(errors);
            }

            var user = _advertiserRepository.Get(request.Username);

            if (user == null)
            {
                throw new Exception("Usuário não encontrado");
            }

            _authenticationService.AuthenticateAdvertiser(request);
            await _signInService.SignInAdvertiserAsync(user, true);

            return(new AuthenticateResponse {
                ReturnUrl = request.ReturnUrl ?? "/Advertiser/Home/Index"
            });
        }