This is an automated email from the ASF dual-hosted git repository. mmoayyed pushed a commit to branch cas65 in repository https://gitbox.apache.org/repos/asf/syncope.git
commit 720c0d3527f92ef533de6e3dc25aa619556a8379 Author: Misagh <mm1...@gmail.com> AuthorDate: Tue Feb 15 12:08:41 2022 +0400 make sure content-type is specified for registered-services endpoint --- .../org/apache/syncope/core/logic/ClientAppLogic.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/ClientAppLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/ClientAppLogic.java index 6629fc0..4f3a3cd 100644 --- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/ClientAppLogic.java +++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/ClientAppLogic.java @@ -29,6 +29,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import javax.ws.rs.InternalServerErrorException; import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; + import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.cxf.transport.http.auth.DefaultBasicAuthSupplier; @@ -262,13 +264,16 @@ public class ClientAppLogic extends AbstractTransactionalLogic<ClientAppTO> { public void pushToWA() { try { NetworkService wa = serviceOps.get(NetworkService.Type.WA); + String basicAuthHeader = DefaultBasicAuthSupplier.getBasicAuthHeader( + securityProperties.getAnonymousUser(), securityProperties.getAnonymousKey()); + URI endpoint = URI.create(StringUtils.appendIfMissing(wa.getAddress(), "/") + + "actuator/registeredServices"); HttpClient.newBuilder().build().send( - HttpRequest.newBuilder(URI.create( - StringUtils.appendIfMissing(wa.getAddress(), "/") + "actuator/registeredServices")). - header(HttpHeaders.AUTHORIZATION, DefaultBasicAuthSupplier.getBasicAuthHeader( - securityProperties.getAnonymousUser(), securityProperties.getAnonymousKey())). - GET().build(), - HttpResponse.BodyHandlers.discarding()); + HttpRequest.newBuilder(endpoint). + header(HttpHeaders.AUTHORIZATION, basicAuthHeader). + header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON). + GET().build(), + HttpResponse.BodyHandlers.discarding()); } catch (KeymasterException e) { throw new NotFoundException("Could not find any WA instance", e); } catch (IOException | InterruptedException e) {