KEYCLOAK-6866 Error 404 after changing locale while authenticating using X.509
This commit is contained in:
1 parent
ea8eaaff07
commit
524ab44160
10 files changed
+123
-26
No files matched your search
+2
-1
@@ -20,6 +20,7 @@ package org.keycloak.testsuite.pages.x509;
|
||||
|
||||
import org.jboss.arquillian.test.api.ArquillianResource;
|
||||
import org.keycloak.testsuite.pages.AbstractPage;
|
||||
import org.keycloak.testsuite.pages.LanguageComboboxAwarePage;
|
||||
import org.keycloak.testsuite.util.OAuthClient;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
@@ -30,7 +31,7 @@ import org.openqa.selenium.support.FindBy;
|
||||
* @since 10/24/2016
|
||||
*/
|
||||
|
||||
public class X509IdentityConfirmationPage extends AbstractPage {
|
||||
public class X509IdentityConfirmationPage extends LanguageComboboxAwarePage {
|
||||
|
||||
@ArquillianResource
|
||||
protected OAuthClient oauth;
|
||||
|
||||
+4
-3
@@ -98,6 +98,7 @@ public abstract class AbstractX509AuthenticationTest extends AbstractTestRealmKe
|
||||
@Rule
|
||||
public AssertAdminEvents assertAdminEvents = new AssertAdminEvents(this);
|
||||
|
||||
@Override
|
||||
protected boolean isImportAfterEachMethod() {
|
||||
return true;
|
||||
}
|
||||
@@ -113,9 +114,9 @@ public abstract class AbstractX509AuthenticationTest extends AbstractTestRealmKe
|
||||
|
||||
cliArgs.append("--ignore-ssl-errors=true ");
|
||||
cliArgs.append("--web-security=false ");
|
||||
cliArgs.append("--ssl-certificates-path=" + authServerHome + "/ca.crt ");
|
||||
cliArgs.append("--ssl-client-certificate-file=" + authServerHome + "/client.crt ");
|
||||
cliArgs.append("--ssl-client-key-file=" + authServerHome + "/client.key ");
|
||||
cliArgs.append("--ssl-certificates-path=").append(authServerHome).append("/ca.crt ");
|
||||
cliArgs.append("--ssl-client-certificate-file=").append(authServerHome).append("/client.crt ");
|
||||
cliArgs.append("--ssl-client-key-file=").append(authServerHome).append("/client.key ");
|
||||
cliArgs.append("--ssl-client-key-passphrase=secret ");
|
||||
|
||||
System.setProperty("keycloak.phantomjs.cli.args", cliArgs.toString());
|
||||
|
||||
+34
@@ -33,11 +33,16 @@ import org.keycloak.testsuite.pages.x509.X509IdentityConfirmationPage;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.keycloak.authentication.authenticators.x509.X509AuthenticatorConfigModel.IdentityMapperType.USERNAME_EMAIL;
|
||||
import static org.keycloak.authentication.authenticators.x509.X509AuthenticatorConfigModel.IdentityMapperType.USER_ATTRIBUTE;
|
||||
import static org.keycloak.authentication.authenticators.x509.X509AuthenticatorConfigModel.MappingSourceType.SUBJECTDN;
|
||||
import static org.keycloak.authentication.authenticators.x509.X509AuthenticatorConfigModel.MappingSourceType.SUBJECTDN_EMAIL;
|
||||
import org.keycloak.testsuite.ProfileAssume;
|
||||
import org.keycloak.testsuite.util.DroneUtils;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:brat000012001@gmail.com">Peter Nalyvayko</a>
|
||||
@@ -483,4 +488,33 @@ public class X509BrowserLoginTest extends AbstractX509AuthenticationTest {
|
||||
loginAsUserFromCertSubjectEmail();
|
||||
}
|
||||
|
||||
// KEYCLOAK-6866
|
||||
@Test
|
||||
public void changeLocaleOnX509InfoPage() {
|
||||
ProfileAssume.assumeCommunity();
|
||||
|
||||
AuthenticatorConfigRepresentation cfg = newConfig("x509-browser-config", createLoginSubjectEmail2UsernameOrEmailConfig().getConfig());
|
||||
String cfgId = createConfig(browserExecution.getId(), cfg);
|
||||
Assert.assertNotNull(cfgId);
|
||||
|
||||
log.debug("Open confirm page");
|
||||
loginConfirmationPage.open();
|
||||
|
||||
log.debug("check if on confirm page");
|
||||
Assert.assertThat(loginConfirmationPage.getSubjectDistinguishedNameText(), startsWith("EMAILADDRESS=test-user@localhost"));
|
||||
log.debug("check if locale is EN");
|
||||
Assert.assertThat(loginConfirmationPage.getLanguageDropdownText(), is(equalTo("English")));
|
||||
|
||||
log.debug("change locale to DE");
|
||||
loginConfirmationPage.openLanguage("Deutsch");
|
||||
log.debug("check if locale is DE");
|
||||
Assert.assertThat(loginConfirmationPage.getLanguageDropdownText(), is(equalTo("Deutsch")));
|
||||
Assert.assertThat(DroneUtils.getCurrentDriver().getPageSource(), containsString("X509 Client Zertifikat:"));
|
||||
|
||||
log.debug("confirm cert");
|
||||
loginConfirmationPage.confirm();
|
||||
|
||||
log.debug("check if logged in");
|
||||
Assert.assertThat(appPage.getRequestType(), is(equalTo(AppPage.RequestType.AUTH_RESPONSE)));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user