public async Task <IActionResult> Authenticate([FromBody] ClientAuthModel authModel) { var client = await _clientService.AuthenticateAsync(authModel); if (client == null) { return(Unauthorized()); } string access_token = _tekonManager.GenerateAccessToken(client.Id); return(Ok(new { client, access_token })); }
public async Task <ClientReadModel> AuthenticateAsync(ClientAuthModel authModel) { var client = await _clientRepository.GetAsync(c => c.PersonalId == authModel.PersonalId); if (client == null) { return(null); } if (!_passwordService.Match(authModel.Password, client.PasswordHash)) { return(null); } return(_mapper.Map <ClientReadModel>(client)); }
public static ClientAuthModel SendRequestClientProfileCompanyInfoPatch(ClientAuthModel clientAuthModel) { var client = new RestClient(" https://api.newbookmodels.com/api/v1/client/profile/"); var request = new RestRequest(Method.PATCH); var changeProfileCompanyInfoModel = new Dictionary <string, string> { { "company_description", "Something" }, { "company_name", "Company" }, { "company_website", "http://companyComassasapany.com" }, }; request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", clientAuthModel.TokenData.Token); request.AddJsonBody(changeProfileCompanyInfoModel); request.RequestFormat = DataFormat.Json; var response = client.Execute(request); return(clientAuthModel); }
public ChangePasswordSteps(ScenarioContext scenarioContext) { _scenarioContext = scenarioContext; _user = _scenarioContext.Get <ClientAuthModel>(Context.User); }
public ChangeGeneralInformationSteps(ScenarioContext scenarioContext) { _scenarioContext = scenarioContext; _user = _scenarioContext.Get <ClientAuthModel>(Context.User); }
public new void Setup() { _user = CreateUserViaApi(); _signInPage = new SignInPage(_webDriver); }