From 4bc511b25d35990e86f1b62e4d1c7479cab067f1 Mon Sep 17 00:00:00 2001 From: Okke Harsta Date: Wed, 6 Nov 2024 09:48:55 +0100 Subject: [PATCH] Bugfix for strict headers --- src/main/java/generiek/api/EnrollmentEndpoint.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/generiek/api/EnrollmentEndpoint.java b/src/main/java/generiek/api/EnrollmentEndpoint.java index 9a4a150..ed0ad1d 100644 --- a/src/main/java/generiek/api/EnrollmentEndpoint.java +++ b/src/main/java/generiek/api/EnrollmentEndpoint.java @@ -136,6 +136,11 @@ public EnrollmentEndpoint(@Value("${oidc.acr-context-class-ref}") String acr, this.restTemplate = new RestTemplate(requestFactory); this.restTemplate.getInterceptors().add((request, body, execution) -> { request.getHeaders().add("Accept-Language", LanguageFilter.language.get()); + //Bugfix for too strict DefaultBearerTokenResolver which does not ignore CHARSET + List contentType = request.getHeaders().get("Content-Type"); + if (!CollectionUtils.isEmpty(contentType) && contentType.getFirst().startsWith("application/x-www-form-urlencoded")) { + request.getHeaders().set("Content-Type", "application/x-www-form-urlencoded"); + } return execution.execute(request, body); }); this.restTemplate.getInterceptors().add(new RestTemplateLoggingInterceptor());