KEYCLOAK-18264 Fix SamlLogoutTest with different consumer and provider url
This commit is contained in:
parent
4dcb69596b
commit
b216b9579c
2 changed files with 12 additions and 6 deletions
|
@ -71,8 +71,8 @@ import static org.keycloak.testsuite.admin.ApiUtil.resetUserPassword;
|
||||||
import static org.keycloak.testsuite.broker.BrokerTestConstants.USER_EMAIL;
|
import static org.keycloak.testsuite.broker.BrokerTestConstants.USER_EMAIL;
|
||||||
import static org.keycloak.testsuite.broker.BrokerTestTools.encodeUrl;
|
import static org.keycloak.testsuite.broker.BrokerTestTools.encodeUrl;
|
||||||
import static org.keycloak.testsuite.broker.BrokerTestTools.getConsumerRoot;
|
import static org.keycloak.testsuite.broker.BrokerTestTools.getConsumerRoot;
|
||||||
|
import static org.keycloak.testsuite.broker.BrokerTestTools.getProviderRoot;
|
||||||
import static org.keycloak.testsuite.broker.BrokerTestTools.waitForPage;
|
import static org.keycloak.testsuite.broker.BrokerTestTools.waitForPage;
|
||||||
import static org.keycloak.testsuite.util.WaitUtils.waitForPageToLoad;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No test methods there. Just some useful common functionality
|
* No test methods there. Just some useful common functionality
|
||||||
|
@ -343,10 +343,16 @@ public abstract class AbstractBaseBrokerTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
|
|
||||||
protected URI getConsumerSamlEndpoint(String realm) throws IllegalArgumentException, UriBuilderException {
|
protected URI getConsumerSamlEndpoint(String realm) throws IllegalArgumentException, UriBuilderException {
|
||||||
return RealmsResource
|
return getSamlEndpoint(getConsumerRoot(), realm);
|
||||||
.protocolUrl(UriBuilder.fromUri(getConsumerRoot()).path("auth"))
|
|
||||||
.build(realm, SamlProtocol.LOGIN_PROTOCOL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected URI getProviderSamlEndpoint(String realm) throws IllegalArgumentException, UriBuilderException {
|
||||||
|
return getSamlEndpoint(getProviderRoot(), realm);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected URI getSamlEndpoint(String fromUri, String realm) {
|
||||||
|
return RealmsResource
|
||||||
|
.protocolUrl(UriBuilder.fromUri(fromUri).path("auth"))
|
||||||
|
.build(realm, SamlProtocol.LOGIN_PROTOCOL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class KcSamlLogoutTest extends AbstractInitializedBaseBrokerTest {
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
// Login using a different client to the provider realm, should be already logged in
|
// Login using a different client to the provider realm, should be already logged in
|
||||||
.authnRequest(getConsumerSamlEndpoint(bc.providerRealmName()), PROVIDER_SAML_CLIENT_ID, PROVIDER_SAML_CLIENT_ID + "saml", POST).build()
|
.authnRequest(getProviderSamlEndpoint(bc.providerRealmName()), PROVIDER_SAML_CLIENT_ID, PROVIDER_SAML_CLIENT_ID + "saml", POST).build()
|
||||||
.followOneRedirect()
|
.followOneRedirect()
|
||||||
|
|
||||||
// Process saml response and store reference to nameId and sessionIndex so that we can initiate logout for the session
|
// Process saml response and store reference to nameId and sessionIndex so that we can initiate logout for the session
|
||||||
|
@ -141,7 +141,7 @@ public class KcSamlLogoutTest extends AbstractInitializedBaseBrokerTest {
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
// Send logout request to provider realm
|
// Send logout request to provider realm
|
||||||
.logoutRequest(getConsumerSamlEndpoint(bc.providerRealmName()), PROVIDER_SAML_CLIENT_ID, POST)
|
.logoutRequest(getProviderSamlEndpoint(bc.providerRealmName()), PROVIDER_SAML_CLIENT_ID, POST)
|
||||||
.nameId(nameIdRef::get)
|
.nameId(nameIdRef::get)
|
||||||
.sessionIndex(sessionIndexRef::get)
|
.sessionIndex(sessionIndexRef::get)
|
||||||
.build()
|
.build()
|
||||||
|
|
Loading…
Reference in a new issue