diff --git a/pom.xml b/pom.xml
index f937a7d52f..39e3315af1 100755
--- a/pom.xml
+++ b/pom.xml
@@ -210,6 +210,21 @@
javase
2.2
+
+
+ org.jboss.arquillian
+ arquillian-bom
+ 1.1.1.Final
+ pom
+ import
+
+
+ org.jboss.arquillian.extension
+ arquillian-drone-bom
+ 1.2.0.Alpha3
+ pom
+ import
+
diff --git a/testsuite/pom.xml b/testsuite/pom.xml
new file mode 100755
index 0000000000..523bbf1a8f
--- /dev/null
+++ b/testsuite/pom.xml
@@ -0,0 +1,190 @@
+
+
+
+ keycloak-parent
+ org.keycloak
+ 1.0-alpha-1
+ ../pom.xml
+
+ 4.0.0
+
+ keycloak-testsuite
+ Keycloak TestSuite
+
+
+
+
+
+ org.keycloak
+ keycloak-as7-adapter
+ ${project.version}
+
+
+
+
+
+
+ org.jboss.resteasy
+ jose-jwt
+ provided
+
+
+ org.keycloak
+ keycloak-core
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-services
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-social-core
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-social-google
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-social-twitter
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-social-facebook
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-forms
+ ${project.version}
+
+
+ org.picketlink
+ picketlink-idm-api
+
+
+ org.picketlink
+ picketlink-idm-impl
+
+
+ org.picketlink
+ picketlink-idm-simple-schema
+
+
+ org.picketlink
+ picketlink-config
+
+
+ org.jboss.resteasy
+ resteasy-jaxrs
+ provided
+
+
+ log4j
+ log4j
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-simple
+
+
+
+
+ org.jboss.resteasy
+ jaxrs-api
+ provided
+
+
+ com.h2database
+ h2
+ 1.3.161
+
+
+
+ junit
+ junit
+
+
+ org.jboss.arquillian.junit
+ arquillian-junit-container
+ test
+
+
+ org.jboss.arquillian.extension
+ arquillian-drone-impl
+ test
+
+
+ org.jboss.arquillian.extension
+ arquillian-drone-selenium
+ test
+
+
+ org.jboss.arquillian.extension
+ arquillian-drone-selenium-server
+ test
+
+
+ org.seleniumhq.selenium
+ selenium-java
+ test
+
+
+ org.seleniumhq.selenium
+ selenium-server
+ test
+
+
+ org.mortbay.jetty
+ servlet-api-2.5
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.6
+
+
+
+
+
+
+
+ jboss-managed
+
+
+ org.jboss.as
+ jboss-as-arquillian-container-managed
+ test
+ 7.1.1.Final
+
+
+
+
+ jboss-remote
+
+
+ org.jboss.as
+ jboss-as-arquillian-container-remote
+ test
+ 7.1.1.Final
+
+
+
+
+
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/AbstractDroneTest.java b/testsuite/src/test/java/org/keycloak/testsuite/AbstractDroneTest.java
new file mode 100644
index 0000000000..eecc84aa40
--- /dev/null
+++ b/testsuite/src/test/java/org/keycloak/testsuite/AbstractDroneTest.java
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.testsuite;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+
+/**
+ * @author Stian Thorgersen
+ */
+public abstract class AbstractDroneTest {
+
+ @Deployment(name = "app", testable = false, order = 2)
+ public static WebArchive appDeployment() {
+ File[] libs = Maven.resolver().loadPomFromFile("pom.xml")
+ .resolve("org.keycloak:keycloak-core", "org.keycloak:keycloak-as7-adapter").withoutTransitivity().asFile();
+
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, "app.war").addClasses(TestApplication.class)
+ .addAsLibraries(libs).addAsWebInfResource("jboss-deployment-structure.xml")
+ .addAsWebInfResource("app-web.xml", "web.xml").addAsWebInfResource("app-jboss-web.xml", "jboss-web.xml")
+ .addAsWebInfResource("app-resteasy-oauth.json", "resteasy-oauth.json").addAsWebResource("user.jsp");
+ return archive;
+ }
+
+ @Deployment(name = "auth-server", testable = false, order = 1)
+ public static WebArchive deployment() {
+ File[] libs = Maven.resolver().loadPomFromFile("pom.xml").importRuntimeDependencies().resolve().withTransitivity()
+ .asFile();
+
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, "auth-server.war").addClasses(TestApplication.class)
+ .addAsLibraries(libs).addAsWebInfResource("jboss-deployment-structure.xml").addAsWebInfResource("web.xml")
+ .addAsResource("persistence.xml", "META-INF/persistence.xml")
+ .addAsResource("testrealm.json", "META-INF/testrealm.json");
+
+ return archive;
+ }
+
+ URL appUrl;
+
+ URL authServerUrl;
+
+ String DEFAULT_WAIT = "10000";
+
+ @Drone
+ DefaultSelenium selenium;
+
+ @After
+ public void after() {
+ logout();
+ }
+
+ @Before
+ public void before() throws MalformedURLException {
+ authServerUrl = new URL("http://localhost:8080/auth-server");
+ appUrl = new URL("http://localhost:8080/app/user.jsp");
+ }
+
+ public void login(String username, String password) {
+ login(username, password, null);
+ }
+
+ public void login(String username, String password, String expectErrorMessage) {
+ selenium.open(appUrl.toString());
+ selenium.waitForPageToLoad(DEFAULT_WAIT);
+
+ Assert.assertEquals("Log in to demo", selenium.getTitle());
+
+ if (username != null) {
+ selenium.type("id=username", username);
+ }
+
+ if (password != null) {
+ selenium.type("id=password", password);
+ }
+
+ selenium.click("css=input[type=\"submit\"]");
+
+ selenium.waitForPageToLoad(DEFAULT_WAIT);
+
+ if (expectErrorMessage == null) {
+ Assert.assertEquals(username, selenium.getText("id=user"));
+ } else {
+ Assert.assertTrue(selenium.isTextPresent(expectErrorMessage));
+ }
+ }
+
+ public void logout() {
+ selenium.open(authServerUrl + "/rest/realms/demo/tokens/logout?redirect_uri=" + appUrl);
+ selenium.waitForPageToLoad(DEFAULT_WAIT);
+
+ Assert.assertEquals("Log in to demo", selenium.getTitle());
+ }
+
+ public void registerUser(String username, String password) {
+ registerUser(username, password, null);
+ }
+
+ public void registerUser(String username, String password, String expectErrorMessage) {
+ selenium.open(appUrl.toString());
+ selenium.waitForPageToLoad(DEFAULT_WAIT);
+
+ selenium.click("link=Register");
+ selenium.waitForPageToLoad(DEFAULT_WAIT);
+ selenium.type("id=name", "Test User");
+ selenium.type("id=email", "test@user.com");
+ if (username != null) {
+ selenium.type("id=username", username);
+ }
+ if (password != null) {
+ selenium.type("id=password", password);
+ selenium.type("id=password-confirm", password);
+ }
+ selenium.click("css=input[type=\"submit\"]");
+ selenium.waitForPageToLoad(DEFAULT_WAIT);
+
+ if (expectErrorMessage == null) {
+ Assert.assertEquals(username, selenium.getText("id=user"));
+ } else {
+ Assert.assertTrue(selenium.isTextPresent(expectErrorMessage));
+ }
+ }
+
+}
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/LoginTest.java b/testsuite/src/test/java/org/keycloak/testsuite/LoginTest.java
new file mode 100644
index 0000000000..fab2d16fea
--- /dev/null
+++ b/testsuite/src/test/java/org/keycloak/testsuite/LoginTest.java
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.testsuite;
+
+import org.jboss.arquillian.junit.Arquillian;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Stian Thorgersen
+ */
+@RunWith(Arquillian.class)
+public class LoginTest extends AbstractDroneTest {
+
+ @Test
+ public void loginInvalidPassword() {
+ login("invalid", "password", "Invalid username or password");
+ }
+
+ @Test
+ public void loginInvalidUsername() {
+ login("invalid", "password", "Invalid username or password");
+ }
+
+ @Test
+ public void loginSuccess() {
+ login("bburke@redhat.com", "password");
+ }
+
+}
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/RegisterTest.java b/testsuite/src/test/java/org/keycloak/testsuite/RegisterTest.java
new file mode 100644
index 0000000000..96cf70d5fa
--- /dev/null
+++ b/testsuite/src/test/java/org/keycloak/testsuite/RegisterTest.java
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.testsuite;
+
+import org.jboss.arquillian.junit.Arquillian;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Stian Thorgersen
+ */
+@RunWith(Arquillian.class)
+public class RegisterTest extends AbstractDroneTest {
+
+ @Test
+ public void registerUserMissingPassword() {
+ registerUser("registerUserMissingPassword", null, "Please specify password");
+ }
+
+ @Test
+ public void registerUserMissingUsername() {
+ registerUser(null, "password", "Please specify username");
+ }
+
+ @Test
+ public void registerUserSuccess() {
+ registerUser("registerUserSuccess", "password");
+ }
+
+}
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/TestApplication.java b/testsuite/src/test/java/org/keycloak/testsuite/TestApplication.java
new file mode 100755
index 0000000000..0b1dcf5df8
--- /dev/null
+++ b/testsuite/src/test/java/org/keycloak/testsuite/TestApplication.java
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.testsuite;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.jboss.resteasy.jwt.JsonSerialization;
+import org.keycloak.representations.idm.CredentialRepresentation;
+import org.keycloak.representations.idm.RealmRepresentation;
+import org.keycloak.services.managers.RealmManager;
+import org.keycloak.services.models.KeycloakSession;
+import org.keycloak.services.models.RealmModel;
+import org.keycloak.services.resources.KeycloakApplication;
+import org.keycloak.services.resources.SaasService;
+
+/**
+ * @author Bill Burke
+ * @version $Revision: 1 $
+ */
+public class TestApplication extends KeycloakApplication {
+
+ public static RealmRepresentation loadJson(String path)
+ {
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ int c;
+ try {
+ while ( (c = is.read()) != -1)
+ {
+ os.write(c);
+ }
+ byte[] bytes = os.toByteArray();
+ //System.out.println(new String(bytes));
+
+ return JsonSerialization.fromBytes(RealmRepresentation.class, bytes);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public TestApplication() {
+ super();
+ KeycloakSession session = factory.createSession();
+ session.getTransaction().begin();
+ RealmManager realmManager = new RealmManager(session);
+ if (realmManager.defaultRealm() == null) {
+ install(realmManager);
+ }
+ session.getTransaction().commit();
+ }
+
+ public void install(RealmManager manager) {
+ RealmModel defaultRealm = manager.createRealm(RealmModel.DEFAULT_REALM, RealmModel.DEFAULT_REALM);
+ defaultRealm.setName(RealmModel.DEFAULT_REALM);
+ defaultRealm.setEnabled(true);
+ defaultRealm.setTokenLifespan(300);
+ defaultRealm.setAccessCodeLifespan(60);
+ defaultRealm.setSslNotRequired(true);
+ defaultRealm.setCookieLoginAllowed(true);
+ defaultRealm.setRegistrationAllowed(true);
+ manager.generateRealmKeys(defaultRealm);
+ defaultRealm.addRequiredCredential(CredentialRepresentation.PASSWORD);
+ defaultRealm.addRole(SaasService.REALM_CREATOR_ROLE);
+ defaultRealm.addDefaultRole(SaasService.REALM_CREATOR_ROLE);
+
+ RealmRepresentation rep = loadJson("META-INF/testrealm.json");
+ RealmModel realm = manager.createRealm("demo", rep.getRealm());
+ manager.importRealm(rep, realm);
+
+ }
+
+
+}
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/TotpTest.java b/testsuite/src/test/java/org/keycloak/testsuite/TotpTest.java
new file mode 100644
index 0000000000..ca557f1601
--- /dev/null
+++ b/testsuite/src/test/java/org/keycloak/testsuite/TotpTest.java
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.testsuite;
+
+import java.net.MalformedURLException;
+
+import org.jboss.arquillian.junit.Arquillian;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.picketlink.idm.credential.util.TimeBasedOTP;
+
+/**
+ * @author Stian Thorgersen
+ */
+@RunWith(Arquillian.class)
+public class TotpTest extends AbstractDroneTest {
+
+ private TimeBasedOTP totp;
+ private String totpSecret;
+
+ @Before
+ public void before() throws MalformedURLException {
+ super.before();
+
+ totp = new TimeBasedOTP();
+ }
+
+ public void configureTotp() {
+ selenium.open(authServerUrl + "/rest/realms/demo/account/totp");
+ selenium.waitForPageToLoad("10000");
+
+ Assert.assertTrue(selenium.isTextPresent("To setup Google Authenticator"));
+
+ totpSecret = selenium.getValue("totpSecret");
+ String code = totp.generate(totpSecret);
+
+ selenium.type("id=totp", code);
+ selenium.click("css=input[type=\"submit\"]");
+ selenium.waitForPageToLoad("30000");
+
+ Assert.assertTrue(selenium.isTextPresent("Google Authenticator enabled"));
+ }
+
+ @Test
+ public void loginWithTotpFailure() {
+ registerUser("loginWithTotpFailure", "password");
+ configureTotp();
+ logout();
+
+ selenium.type("id=username", "loginWithTotpFailure");
+ selenium.type("id=password", "password");
+
+ selenium.click("css=input[type=\"submit\"]");
+ selenium.waitForPageToLoad(DEFAULT_WAIT);
+
+ Assert.assertEquals("Log in to demo", selenium.getTitle());
+
+ selenium.type("id=totp", "123456");
+
+ selenium.click("css=input[type=\"submit\"]");
+ selenium.waitForPageToLoad(DEFAULT_WAIT);
+
+ Assert.assertTrue(selenium.isTextPresent("Invalid username or password"));
+ }
+
+ @Test
+ public void loginWithTotpSuccess() {
+ registerUser("loginWithTotpSuccess", "password");
+ configureTotp();
+ logout();
+
+ selenium.type("id=username", "loginWithTotpSuccess");
+ selenium.type("id=password", "password");
+
+ selenium.click("css=input[type=\"submit\"]");
+ selenium.waitForPageToLoad(DEFAULT_WAIT);
+
+ Assert.assertEquals("Log in to demo", selenium.getTitle());
+
+ selenium.type("id=totp", totp.generate(totpSecret));
+
+ selenium.click("css=input[type=\"submit\"]");
+ selenium.waitForPageToLoad(DEFAULT_WAIT);
+
+ Assert.assertEquals("loginWithTotpSuccess", selenium.getText("id=user"));
+ }
+
+ @Test
+ public void setupTotp() {
+ registerUser("setupTotp", "password");
+ configureTotp();
+ }
+
+}
diff --git a/testsuite/src/test/resources/app-jboss-web.xml b/testsuite/src/test/resources/app-jboss-web.xml
new file mode 100755
index 0000000000..3cec19cc47
--- /dev/null
+++ b/testsuite/src/test/resources/app-jboss-web.xml
@@ -0,0 +1,5 @@
+
+
+ org.keycloak.adapters.as7.OAuthManagedResourceValve
+
+
\ No newline at end of file
diff --git a/testsuite/src/test/resources/app-resteasy-oauth.json b/testsuite/src/test/resources/app-resteasy-oauth.json
new file mode 100755
index 0000000000..a36b5cf397
--- /dev/null
+++ b/testsuite/src/test/resources/app-resteasy-oauth.json
@@ -0,0 +1,11 @@
+{
+ "realm" : "demo",
+ "resource" : "customer-portal",
+ "realm-public-key" : "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB",
+ "auth-url" : "http://localhost:8080/auth-server/rest/realms/demo/tokens/login",
+ "code-url" : "http://localhost:8080/auth-server/rest/realms/demo/tokens/access/codes",
+ "ssl-not-required" : true,
+ "credentials" : {
+ "password" : "password"
+ }
+}
diff --git a/testsuite/src/test/resources/app-web.xml b/testsuite/src/test/resources/app-web.xml
new file mode 100755
index 0000000000..4ab9fac129
--- /dev/null
+++ b/testsuite/src/test/resources/app-web.xml
@@ -0,0 +1,27 @@
+
+
+
+ app
+
+
+
+ Customers
+ /user.jsp
+
+
+ user
+
+
+
+
+ BASIC
+ commerce
+
+
+
+ user
+
+
diff --git a/testsuite/src/test/resources/arquillian.xml b/testsuite/src/test/resources/arquillian.xml
new file mode 100644
index 0000000000..378dfed7dd
--- /dev/null
+++ b/testsuite/src/test/resources/arquillian.xml
@@ -0,0 +1,9 @@
+
+
+ *googlechrome
+
+
\ No newline at end of file
diff --git a/testsuite/src/test/resources/jboss-deployment-structure.xml b/testsuite/src/test/resources/jboss-deployment-structure.xml
new file mode 100755
index 0000000000..b4aedd49c0
--- /dev/null
+++ b/testsuite/src/test/resources/jboss-deployment-structure.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/testsuite/src/test/resources/persistence.xml b/testsuite/src/test/resources/persistence.xml
new file mode 100755
index 0000000000..ad40046847
--- /dev/null
+++ b/testsuite/src/test/resources/persistence.xml
@@ -0,0 +1,33 @@
+
+
+ java:jboss/datasources/ExampleDS
+
+ org.picketlink.idm.jpa.model.sample.simple.AttributedTypeEntity
+ org.picketlink.idm.jpa.model.sample.simple.AccountTypeEntity
+ org.picketlink.idm.jpa.model.sample.simple.RoleTypeEntity
+ org.picketlink.idm.jpa.model.sample.simple.GroupTypeEntity
+ org.picketlink.idm.jpa.model.sample.simple.IdentityTypeEntity
+ org.picketlink.idm.jpa.model.sample.simple.RelationshipTypeEntity
+ org.picketlink.idm.jpa.model.sample.simple.RelationshipIdentityTypeEntity
+ org.picketlink.idm.jpa.model.sample.simple.PartitionTypeEntity
+ org.picketlink.idm.jpa.model.sample.simple.PasswordCredentialTypeEntity
+ org.picketlink.idm.jpa.model.sample.simple.DigestCredentialTypeEntity
+ org.picketlink.idm.jpa.model.sample.simple.X509CredentialTypeEntity
+ org.picketlink.idm.jpa.model.sample.simple.OTPCredentialTypeEntity
+ org.picketlink.idm.jpa.model.sample.simple.AttributeTypeEntity
+ org.keycloak.services.models.picketlink.mappings.RealmEntity
+ org.keycloak.services.models.picketlink.mappings.ApplicationEntity
+
+ true
+
+
+
+
+
+
+
+
+
diff --git a/testsuite/src/test/resources/testrealm.json b/testsuite/src/test/resources/testrealm.json
new file mode 100755
index 0000000000..cf42937145
--- /dev/null
+++ b/testsuite/src/test/resources/testrealm.json
@@ -0,0 +1,76 @@
+{
+ "realm": "demo",
+ "enabled": true,
+ "tokenLifespan": 300,
+ "accessCodeLifespan": 10,
+ "sslNotRequired": true,
+ "cookieLoginAllowed": true,
+ "registrationAllowed": true,
+ "privateKey": "MIICXAIBAAKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQABAoGAfmO8gVhyBxdqlxmIuglbz8bcjQbhXJLR2EoS8ngTXmN1bo2L90M0mUKSdc7qF10LgETBzqL8jYlQIbt+e6TH8fcEpKCjUlyq0Mf/vVbfZSNaVycY13nTzo27iPyWQHK5NLuJzn1xvxxrUeXI6A2WFpGEBLbHjwpx5WQG9A+2scECQQDvdn9NE75HPTVPxBqsEd2z10TKkl9CZxu10Qby3iQQmWLEJ9LNmy3acvKrE3gMiYNWb6xHPKiIqOR1as7L24aTAkEAtyvQOlCvr5kAjVqrEKXalj0Tzewjweuxc0pskvArTI2Oo070h65GpoIKLc9jf+UA69cRtquwP93aZKtW06U8dQJAF2Y44ks/mK5+eyDqik3koCI08qaC8HYq2wVl7G2QkJ6sbAaILtcvD92ToOvyGyeE0flvmDZxMYlvaZnaQ0lcSQJBAKZU6umJi3/xeEbkJqMfeLclD27XGEFoPeNrmdx0q10Azp4NfJAY+Z8KRyQCR2BEG+oNitBOZ+YXF9KCpH3cdmECQHEigJhYg+ykOvr1aiZUMFT72HU0jnmQe2FVekuG+LJUt2Tm7GtMjTFoGpf0JwrVuZN39fOYAlo+nTixgeW7X8Y=",
+ "publicKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB",
+ "requiredCredentials": [ "password" ],
+ "requiredApplicationCredentials": [ "password" ],
+ "requiredOAuthClientCredentials": [ "password" ],
+ "defaultRoles": [ "user" ],
+ "users" : [
+ {
+ "username" : "bburke@redhat.com",
+ "enabled" : true,
+ "attributes" : {
+ "email" : "bburke@redhat.com"
+ },
+ "credentials" : [
+ { "type" : "password",
+ "value" : "password" }
+ ]
+ },
+ {
+ "username" : "third-party",
+ "enabled" : true,
+ "credentials" : [
+ { "type" : "password",
+ "value" : "password" }
+ ]
+ }
+ ],
+ "roles": [
+ {
+ "name": "user",
+ "description": "Have User privileges"
+ },
+ {
+ "name": "admin",
+ "description": "Have Administrator privileges"
+ }
+ ],
+ "roleMappings": [
+ {
+ "username": "bburke@redhat.com",
+ "roles": ["user"]
+ },
+ {
+ "username": "third-party",
+ "roles": ["KEYCLOAK_IDENTITY_REQUESTER"]
+ }
+ ],
+ "scopeMappings": [
+ {
+ "username": "third-party",
+ "roles": ["user"]
+ }
+ ],
+ "applications": [
+ {
+ "name": "customer-portal",
+ "enabled": true,
+ "adminUrl": "http://localhost:8080/app/j_admin_request",
+ "useRealmMappings": true,
+ "credentials": [
+ {
+ "type": "password",
+ "value": "password"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/testsuite/src/test/resources/user.jsp b/testsuite/src/test/resources/user.jsp
new file mode 100755
index 0000000000..75afd76755
--- /dev/null
+++ b/testsuite/src/test/resources/user.jsp
@@ -0,0 +1,14 @@
+<%@ page import="javax.ws.rs.core.*" language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
+
+
+User
+
+
+ <%
+ String user = request.getUserPrincipal() != null ? request.getUserPrincipal().getName() : "not logged in";
+ String redirectUri = request.getRequestURL().toString();
+ %>
+ logout
+ <%=user%>
+
+
\ No newline at end of file
diff --git a/testsuite/src/test/resources/web.xml b/testsuite/src/test/resources/web.xml
new file mode 100755
index 0000000000..76426e6ccd
--- /dev/null
+++ b/testsuite/src/test/resources/web.xml
@@ -0,0 +1,39 @@
+
+
+
+ auth-server
+
+
+ Resteasy
+ org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher
+
+ javax.ws.rs.Application
+ org.keycloak.testsuite.TestApplication
+
+
+ resteasy.servlet.mapping.prefix
+ /rest
+
+ 1
+ true
+
+
+
+ Resteasy
+ /rest/*
+
+
+
+
+