diff --git a/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java b/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java index f5ed629e32..9ac24c1745 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java @@ -311,7 +311,7 @@ public class UserResource { userSession.setNote(IMPERSONATOR_USERNAME.toString(), impersonator); AuthenticationManager.createLoginCookie(session, realm, userSession.getUser(), userSession, session.getContext().getUri(), clientConnection); - URI redirect = AccountFormService.accountServiceApplicationPage(session.getContext().getUri()).build(realm.getName()); + URI redirect = AccountFormService.accountServiceBaseUrl(session.getContext().getUri()).build(realm.getName()); Map result = new HashMap<>(); result.put("sameRealm", sameRealm); result.put("redirect", redirect.toString()); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/ImpersonationTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/ImpersonationTest.java index 89404dc4c3..f66382d6d9 100755 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/ImpersonationTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/ImpersonationTest.java @@ -64,6 +64,7 @@ import org.keycloak.testsuite.pages.LoginPage; import org.keycloak.testsuite.util.AdminClientUtil; import org.keycloak.testsuite.util.ClientBuilder; import org.keycloak.testsuite.util.CredentialBuilder; +import org.keycloak.testsuite.util.DroneUtils; import org.keycloak.testsuite.util.OAuthClient; import org.keycloak.testsuite.util.RealmBuilder; import org.keycloak.testsuite.util.UserBuilder; @@ -73,6 +74,7 @@ import javax.ws.rs.ClientErrorException; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; import java.io.IOException; +import java.net.URL; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -224,6 +226,8 @@ public class ImpersonationTest extends AbstractKeycloakTest { // Open the URL again - should be directly redirected to the app due the SSO login driver.navigate().to(loginFormUrl); appPage.assertCurrent(); + //KEYCLOAK-12783 + Assert.assertEquals("/auth/realms/master/app/auth", new URL(DroneUtils.getCurrentDriver().getCurrentUrl()).getPath()); // Remove test client ApiUtil.findClientByClientId(realm, "test-app").remove();