[Keycloak CI] - Cookies Tests - KcOidcBrokerTokenExchangeTest

Closes #39950

Signed-off-by: Martin Kanis <mkanis@redhat.com>
This commit is contained in:
Martin Kanis 2025-05-29 12:47:14 +02:00 committed by Pedro Igor
parent b4853de5c6
commit 3aac1eb43d

View File

@ -97,9 +97,7 @@ public class KcOidcBrokerTokenExchangeTest extends AbstractInitializedBaseBroker
@Test
public void testExternalInternalTokenExchangeUsingIssuer() throws Exception {
RealmResource consumerRealm = realmsResouce().realm(bc.consumerRealmName());
IdentityProviderRepresentation broker = consumerRealm.identityProviders().get(bc.getIDPAlias()).toRepresentation();
assertExternalToInternalExchange(broker.getConfig().get(OIDCIdentityProviderConfigRep.ISSUER), true, false);
assertExternalToInternalExchange(bc.getIDPAlias(), true, false);
}
@Test
@ -135,6 +133,9 @@ public class KcOidcBrokerTokenExchangeTest extends AbstractInitializedBaseBroker
if (!representation.getConfig().get("issuer").startsWith(ServerURLs.getAuthServerContextRoot())) {
representation.getConfig().put("issuer", ServerURLs.getAuthServerContextRoot() + "/auth/realms/provider");
}
if (userInfo) {
representation.getConfig().put("userInfoUrl", ServerURLs.getAuthServerContextRoot() + "/auth/realms/provider/protocol/openid-connect/userinfo");
}
identityProviderResource.update(representation);
identityProviderResource.addMapper(hardCodedSessionNoteMapper).close();
@ -325,6 +326,10 @@ public class KcOidcBrokerTokenExchangeTest extends AbstractInitializedBaseBroker
IdentityProviderRepresentation idpRep = identityProviderResource.toRepresentation();
idpRep.getConfig().put("disableUserInfo", "true");
idpRep.getConfig().put("disableTypeClaimCheck", "true");
// if auth.server.host != auth.server.host2 we need to update the issuer in the IDP config
if (!idpRep.getConfig().get("issuer").startsWith(ServerURLs.getAuthServerContextRoot())) {
idpRep.getConfig().put("issuer", ServerURLs.getAuthServerContextRoot() + "/auth/realms/provider");
}
identityProviderResource.update(idpRep);
getCleanup().addCleanup(() -> {
idpRep.getConfig().put("disableUserInfo", "false");
@ -343,7 +348,7 @@ public class KcOidcBrokerTokenExchangeTest extends AbstractInitializedBaseBroker
Client httpClient = AdminClientUtil.createResteasyClient();
try {
WebTarget exchangeUrl = httpClient.target(OAuthClient.AUTH_SERVER_ROOT)
WebTarget exchangeUrl = httpClient.target(ServerURLs.getAuthServerContextRoot() + "/auth")
.path("/realms")
.path(bc.consumerRealmName())
.path("protocol/openid-connect/token");