Tests for mod_auth_mellon
This commit is contained in:
parent
1b0ccae4ac
commit
6c5fb2a4aa
7 changed files with 1297 additions and 0 deletions
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.keycloak.testsuite</groupId>
|
||||
<artifactId>integration-arquillian-tests-other</artifactId>
|
||||
<version>1.9.0.CR1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>integration-arquillian-tests-other-mod_auth_mellon</artifactId>
|
||||
|
||||
<name>Mod_auth_mellon tests</name>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,32 @@
|
|||
package org.keycloak.testsuite.mod_auth_mellon;
|
||||
|
||||
import org.keycloak.testsuite.page.AbstractPageWithInjectedUrl;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* @author mhajas
|
||||
*/
|
||||
public class ModAuthMellonProtectedResource extends AbstractPageWithInjectedUrl{
|
||||
|
||||
@FindBy(linkText = "logout")
|
||||
private WebElement logoutButton;
|
||||
|
||||
@Override
|
||||
public URL getInjectedUrl() {
|
||||
try {
|
||||
return new URL(System.getProperty("apache.mod_auth_mellon.url","http://localhost:8380") + "/auth");
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void logout() {
|
||||
logoutButton.click();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package org.keycloak.testsuite.mod_auth_mellon;
|
||||
|
||||
import org.keycloak.testsuite.page.AbstractPageWithInjectedUrl;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* @author mhajas
|
||||
*/
|
||||
public class ModAuthMellonUnprotectedResource extends AbstractPageWithInjectedUrl{
|
||||
|
||||
@Override
|
||||
public URL getInjectedUrl() {
|
||||
try {
|
||||
return new URL(System.getProperty("apache.mod_auth_mellon.url","http://localhost:8380/"));
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package org.keycloak.testsuite.mod_auth_mellon;
|
||||
|
||||
import org.jboss.arquillian.graphene.page.Page;
|
||||
import org.junit.Test;
|
||||
import org.keycloak.representations.idm.RealmRepresentation;
|
||||
import org.keycloak.testsuite.AbstractAuthTest;
|
||||
import org.keycloak.testsuite.util.URLAssert;
|
||||
|
||||
import javax.xml.transform.TransformerException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.keycloak.testsuite.util.IOUtil.loadRealm;
|
||||
|
||||
/**
|
||||
* @author mhajas
|
||||
*/
|
||||
public class ModAuthMellonTest extends AbstractAuthTest {
|
||||
@Page
|
||||
private ModAuthMellonProtectedResource modAuthMellonProtectedResourcePage;
|
||||
|
||||
@Page
|
||||
private ModAuthMellonUnprotectedResource modAuthMellonUnprotectedResourcePage;
|
||||
|
||||
@Override
|
||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||
testRealms.add(loadRealm("/mellon-realm.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void modAuthMellonTest() throws TransformerException {
|
||||
testRealmPage.setAuthRealm("mellon-test");
|
||||
testRealmSAMLLoginPage.setAuthRealm("mellon-test");
|
||||
|
||||
modAuthMellonUnprotectedResourcePage.navigateTo();
|
||||
assertTrue(driver.getPageSource().contains("Unprotected resource"));
|
||||
|
||||
modAuthMellonProtectedResourcePage.navigateTo();
|
||||
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
testRealmSAMLLoginPage.form().login(bburkeUser);
|
||||
assertTrue(driver.getPageSource().contains("Protected resource"));
|
||||
|
||||
modAuthMellonProtectedResourcePage.logout();
|
||||
assertTrue(driver.getPageSource().contains("Unprotected resource"));
|
||||
|
||||
modAuthMellonProtectedResourcePage.navigateTo();
|
||||
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLLoginPage);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -117,6 +117,12 @@
|
|||
<module>console</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>mod_auth_mellon</id>
|
||||
<modules>
|
||||
<module>mod_auth_mellon</module>
|
||||
</modules>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<auth.server.management.port>10090</auth.server.management.port>
|
||||
<auth.server.management.port.jmx>10099</auth.server.management.port.jmx>
|
||||
<auth.server.ssl.required>false</auth.server.ssl.required>
|
||||
<apache.mod_auth_mellon.url>http://localhost:8380</apache.mod_auth_mellon.url>
|
||||
<startup.timeout.sec>60</startup.timeout.sec>
|
||||
|
||||
<browser>phantomjs</browser>
|
||||
|
|
Loading…
Reference in a new issue