private async Task CreateDepartmentCredentialsAsync() { var uri = $"/api/department/{_workDepartmentId}/workplace"; { var workplaceDescriptor = new WorkplaceCredentialsRequestDto { Scopes = PskOnlineScopes.DeptOperatorWorkplace }; var response = await _httpClient.PostAsJsonAsync(uri, workplaceDescriptor); // Then // the request should succeed response.EnsureSuccessStatusCode(); _operatorWorkplaceCredentials = await response.Content.ReadAsJsonAsync <WorkplaceCredentialsDto>(); } { var workplaceDescriptor = new WorkplaceCredentialsRequestDto { Scopes = PskOnlineScopes.DeptAuditorWorkplace }; // Then // the request should succeed var response = await _httpClient.PostAsJsonAsync(uri, workplaceDescriptor); response.EnsureSuccessStatusCode(); _auditorWorkplaceCredentials = await response.Content.ReadAsJsonAsync <WorkplaceCredentialsDto>(); } }
private async Task CreateBranchCredentialsAsync() { var uri = $"/api/branchoffice/{_workBranchId}/workplace"; var workplaceDescriptor = new WorkplaceCredentialsRequestDto { Scopes = PskOnlineScopes.BranchAuditorWorkplace }; var response = await _httpClient.PostAsJsonAsync(uri, workplaceDescriptor); // Then // the request should succeed response.EnsureSuccessStatusCode(); _branchAuditWorkplaceCredentials = await response.Content.ReadAsJsonAsync <WorkplaceCredentialsDto>(); }
public async Task CreateDepartmentAuditorWorkplace_ShouldSucceed_GivenUserIsAdmin() { // Given // user authenticated as admin in tenant #1 (Gryffindor House) -- see Setup() // When // the admin creates an auditor workplace credentials for an existing department var uri = $"/api/department/{_workDepartmentId}/workplace"; var workplaceDescriptor = new WorkplaceCredentialsRequestDto { Scopes = PskOnlineScopes.DeptAuditorWorkplace }; // Then // the request should succeed var response = await _httpClient.PostAsJsonAsync(uri, workplaceDescriptor); response.EnsureSuccessStatusCode(); _auditorWorkplaceCredentials = await response.Content.ReadAsJsonAsync <WorkplaceCredentialsDto>(); // and the workplace should authenticate successfully using the credentials // in client_credentials OpenId flow }