From c3c858c88a64ff25713ca27a4cf370b84dfc6368 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Tue, 29 Nov 2022 14:20:21 +0100 Subject: [PATCH] Fix OpenshiftClientStorageTest.testCodeGrantFlowWithServiceAccountUsingOAuthRedirectReference (#15741) Closes #15565 --- .../testsuite/openshift/OpenshiftClientStorageTest.java | 6 +++--- .../openshift/client-storage/route-response.json | 8 ++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/openshift/OpenshiftClientStorageTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/openshift/OpenshiftClientStorageTest.java index 537fb9bdc9..e3102800a5 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/openshift/OpenshiftClientStorageTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/openshift/OpenshiftClientStorageTest.java @@ -173,12 +173,12 @@ public final class OpenshiftClientStorageTest extends AbstractTestRealmKeycloakT @Test public void testCodeGrantFlowWithServiceAccountUsingOAuthRedirectReference() { String clientId = "system:serviceaccount:default:sa-oauth-redirect-reference"; - testCodeGrantFlow(clientId, "https://myapp.org/callback", () -> assertSuccessfulResponseWithoutConsent(clientId)); + testCodeGrantFlow(clientId, "http://127.0.0.1:8180/callback", () -> assertSuccessfulResponseWithoutConsent(clientId)); } @Test public void failCodeGrantFlowWithServiceAccountUsingOAuthRedirectReference() throws Exception { - testCodeGrantFlow("system:serviceaccount:default:sa-oauth-redirect-reference", "http://myapp.org/callback", () -> assertEquals(OAuthErrorException.INVALID_REDIRECT_URI, events.poll().getError())); + testCodeGrantFlow("system:serviceaccount:default:sa-oauth-redirect-reference", "http://invalid/callback", () -> assertEquals(OAuthErrorException.INVALID_REDIRECT_URI, events.poll().getError())); } @Test @@ -214,7 +214,7 @@ public final class OpenshiftClientStorageTest extends AbstractTestRealmKeycloakT @Test public void failCodeGrantFlowWithServiceAccountUsingOAuthRedirectUri() throws Exception { - testCodeGrantFlow("system:serviceaccount:default:sa-oauth-redirect-uri", "http://myapp.org/callback", () -> assertEquals(OAuthErrorException.INVALID_REDIRECT_URI, events.poll().getError())); + testCodeGrantFlow("system:serviceaccount:default:sa-oauth-redirect-uri", "http://invalid/callback", () -> assertEquals(OAuthErrorException.INVALID_REDIRECT_URI, events.poll().getError())); } private void testCodeGrantFlow(String clientId, String expectedRedirectUri, Runnable assertThat) { diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/openshift/client-storage/route-response.json b/testsuite/integration-arquillian/tests/base/src/test/resources/openshift/client-storage/route-response.json index 8810603fe0..8e0bdd30c2 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/openshift/client-storage/route-response.json +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/openshift/client-storage/route-response.json @@ -13,22 +13,18 @@ } }, "spec": { - "host": "myapp.org", + "host": "127.0.0.1", "to": { "kind": "Service", "name": "proxy", "weight": 100 }, - "tls": { - "termination": "reencrypt", - "destinationCACertificate": "-----BEGIN COMMENT-----\nThis is an empty PEM file created to provide backwards compatibility\nfor reencrypt routes that have no destinationCACertificate. This \ncontent will only appear for routes accessed via /oapi/v1/routes.\n-----END COMMENT-----\n" - }, "wildcardPolicy": "None" }, "status": { "ingress": [ { - "host": "myapp.org", + "host": "127.0.0.1", "routerName": "router", "conditions": [ {