From c2c1b482eab192c65223ba147c4fc2cab2d42c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Barto=C5=A1?= Date: Mon, 12 Apr 2021 10:57:54 +0200 Subject: [PATCH] KEYCLOAK-17734 LifespanAdapterTest fails due to header check --- .../example/authorization/LifespanAdapterTest.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/LifespanAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/LifespanAdapterTest.java index 063006e748..e737472d15 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/LifespanAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/LifespanAdapterTest.java @@ -23,6 +23,7 @@ import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.hamcrest.Matchers; @@ -155,7 +156,15 @@ public class LifespanAdapterTest extends AbstractPhotozExampleAdapterTest { clientPage.viewProfile((ResponseValidator) response -> { Object headers = response.get("responseHeaders"); assertThat(headers, Matchers.notNullValue()); - assertThat(headers.toString(), Matchers.containsString("WWW-Authenticate: UMA")); + + List headersList = Arrays.asList(headers.toString().split("\r\n")); + String wwwAuthenticate = headersList.stream() + .filter(s -> s.toLowerCase().startsWith("www-authenticate:")) + .findFirst() + .orElse(null); + + assertThat(wwwAuthenticate, Matchers.notNullValue()); + assertThat(wwwAuthenticate, Matchers.containsString("UMA")); }); }