Безопасность Spring mtls между микросервисами с помощью PCF и передача недавно обновленного сертификата
Я использую PCF, PAS и https://github.com/cloudfoundry/java-buildpack-security-provider.
Есть ли пример java того, как использовать его для достижения mtls между моими микросервисами?
Например:
мой микросервис вызывает другой микросервис
@GetMapping("/getCaseList")
@PreAuthorize("hasAnyAuthority('Employer.GetEmployer')")
public ResponseEntity getCaseList(@RequestParam(required = false) String officerEmail) {
HttpEntity<Object> requestEntity = new HttpEntity<>(null, authUtils.getNonRelayAuthHeaders());
try{
ResponseEntity response = restTemplate.exchange("https://casemangement/getCaseList?officerEmail=someofficer@gmail.com",
HttpMethod.GET, requestEntity, Object.class);
return new ResponseEntity(response.getBody(), authUtils.getResponseHeaders(response), response.getStatusCode());
} catch (HttpClientErrorException e){
return new ResponseEntity(e.getMessage(), e.getStatusCode());
}
}
Мой прием вызова микросервиса
@GetMapping("/getCaseList")
public ResponseEntity getCaseList(Principal principal, @RequestParam(required = false) String officerEmail) {
String applicationId = principal.getName();
String certificateSerialNumber = this.serialNumberExtractor.getSerialNumber(principal);
System.out.println(String.format("You authenticated using x509 certificate for %s with SN %s", applicationId, certificateSerialNumber));
return new ResponseEntity(caseService.getCaseList(officerEmail), HttpStatus.OK);
}
Как мне использовать вышеперечисленное для установления соединения mtls?