|
10 | 10 | import org.apache.commons.logging.LogFactory; |
11 | 11 | import org.springframework.core.ParameterizedTypeReference; |
12 | 12 | import org.springframework.core.io.ClassPathResource; |
13 | | -import org.springframework.http.*; |
| 13 | +import org.springframework.http.HttpEntity; |
| 14 | +import org.springframework.http.HttpMethod; |
| 15 | +import org.springframework.http.HttpStatus; |
| 16 | +import org.springframework.http.ResponseEntity; |
14 | 17 | import org.springframework.util.StringUtils; |
15 | 18 | import org.springframework.web.client.ResponseErrorHandler; |
16 | 19 | import org.springframework.web.client.RestTemplate; |
@@ -257,7 +260,7 @@ public List<Map<String, Object>> serviceProvidersByEntityID(List<String> entityI |
257 | 260 | public List<Map<String, Object>> identityProvidersByInstitutionalGUID(Environment environment, String organisationGUID) { |
258 | 261 | LOG.debug("identityProviderByInstitutionalGUID for : " + organisationGUID); |
259 | 262 |
|
260 | | - Map<String, Object> baseQuery = getBaseQuery(false); |
| 263 | + Map<String, Object> baseQuery = getBaseQuery(true); |
261 | 264 | baseQuery.put("metaDataFields.coin:institution_guid", organisationGUID); |
262 | 265 |
|
263 | 266 | String url = String.format("%s/manage/api/internal/search/%s", |
@@ -341,6 +344,25 @@ public List<Map<String, Object>> identityProvidersByAllowedConnections(List<Conn |
341 | 344 | return restTemplate.postForEntity(URI.create(url), body, List.class).getBody(); |
342 | 345 | } |
343 | 346 |
|
| 347 | + @Override |
| 348 | + public List<Map<String, Object>> policiesByServiceProvider(String identityProviderEntityId, |
| 349 | + String serviceProviderEntityId) { |
| 350 | + String query = """ |
| 351 | + { |
| 352 | + "data.serviceProviderIds.name": "%s", |
| 353 | + $or: [ |
| 354 | + { "data.identityProviderIds": { $size: 0 } }, |
| 355 | + { "data.identityProviderIds": { $exists: false } }, |
| 356 | + { "data.identityProviderIds.name": "%s" } |
| 357 | + ] |
| 358 | + }) |
| 359 | + """.formatted(serviceProviderEntityId, identityProviderEntityId); |
| 360 | + RestTemplate restTemplate = environmentRestTemplate(Environment.PROD); |
| 361 | + String url = String.format("%s/manage/api/internal/rawSearch/%s", |
| 362 | + environmentUrl(Environment.PROD), EntityType.policy); |
| 363 | + return restTemplate.postForEntity(url, query, List.class).getBody(); |
| 364 | + } |
| 365 | + |
344 | 366 | @Override |
345 | 367 | public void connectWithoutInteraction(Map<String, Object> identityProvider, Map<String, Object> serviceProvider, User user) { |
346 | 368 | RestTemplate restTemplate = environmentRestTemplate(Environment.PROD); |
|
0 commit comments