Removed Arquillian from testsuite
This commit is contained in:
parent
b5a9cfc57e
commit
29015dbabf
52 changed files with 1362 additions and 1417 deletions
20
pom.xml
20
pom.xml
|
@ -61,6 +61,7 @@
|
|||
<module>forms</module>
|
||||
<module>admin-ui-styles</module>
|
||||
<module>examples</module>
|
||||
<module>testsuite</module>
|
||||
<!--<module>ui</module> -->
|
||||
</modules>
|
||||
|
||||
|
@ -234,21 +235,18 @@
|
|||
<artifactId>greenmail</artifactId>
|
||||
<version>1.3.1b</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Arquillian -->
|
||||
<dependency>
|
||||
<groupId>org.jboss.arquillian</groupId>
|
||||
<artifactId>arquillian-bom</artifactId>
|
||||
<version>1.1.1.Final</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Selenium -->
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-java</artifactId>
|
||||
<version>2.26.0</version>
|
||||
<version>2.35.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-chrome-driver</artifactId>
|
||||
<version>2.35.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>jose-jwt</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk16</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-core</artifactId>
|
||||
|
@ -63,76 +63,143 @@
|
|||
<artifactId>keycloak-forms</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.logging</groupId>
|
||||
<artifactId>jboss-logging</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.picketlink</groupId>
|
||||
<artifactId>picketlink-idm-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.picketlink</groupId>
|
||||
<artifactId>picketlink-common</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.picketlink</groupId>
|
||||
<artifactId>picketlink-idm-impl</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.picketlink</groupId>
|
||||
<artifactId>picketlink-idm-simple-schema</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.picketlink</groupId>
|
||||
<artifactId>picketlink-config</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jaxrs</artifactId>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>jaxrs-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-client</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-crypto</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>jose-jwt</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-undertow</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.undertow</groupId>
|
||||
<artifactId>undertow-servlet</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.undertow</groupId>
|
||||
<artifactId>undertow-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-core-asl</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-asl</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.spec.javax.servlet</groupId>
|
||||
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-xc</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate.javax.persistence</groupId>
|
||||
<artifactId>hibernate-jpa-2.0-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.3.161</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-entitymanager</artifactId>
|
||||
<version>3.6.6.Final</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.picketlink</groupId>
|
||||
<artifactId>picketlink-idm-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.picketlink</groupId>
|
||||
<artifactId>picketlink-idm-impl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.picketlink</groupId>
|
||||
<artifactId>picketlink-idm-simple-schema</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.picketlink</groupId>
|
||||
<artifactId>picketlink-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jaxrs</artifactId>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>jaxrs-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.3.161</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.arquillian.junit</groupId>
|
||||
<artifactId>arquillian-junit-container</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<groupId>com.icegreen</groupId>
|
||||
<artifactId>greenmail</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-java</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.shrinkwrap.resolver</groupId>
|
||||
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.icegreen</groupId>
|
||||
<artifactId>greenmail</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* 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.container.test.api.Deployment;
|
||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||
import org.junit.After;
|
||||
import org.junit.Rule;
|
||||
import org.keycloak.testsuite.pages.AppPage;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.pages.RegisterPage;
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.keycloak.testsuite.rule.Page;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
public abstract class AbstractDroneTest {
|
||||
|
||||
@Deployment(name = "app", testable = false, order = 2)
|
||||
public static WebArchive appDeployment() {
|
||||
return Deployments.appDeployment();
|
||||
}
|
||||
|
||||
@Deployment(name = "auth-server", testable = false, order = 1)
|
||||
public static WebArchive deployment() {
|
||||
return Deployments.deployment();
|
||||
}
|
||||
|
||||
@Rule
|
||||
public WebRule webRule = new WebRule(this);
|
||||
|
||||
@Page
|
||||
protected AppPage appPage;
|
||||
|
||||
@Driver
|
||||
protected WebDriver driver;
|
||||
|
||||
@Page
|
||||
protected LoginPage loginPage;
|
||||
|
||||
@Page
|
||||
protected RegisterPage registerPage;
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
appPage.open();
|
||||
if (appPage.isCurrent()) {
|
||||
appPage.logout();
|
||||
}
|
||||
driver.manage().deleteAllCookies();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* 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.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.keycloak.testsuite.pages.ChangePasswordPage;
|
||||
import org.keycloak.testsuite.pages.UpdateProfilePage;
|
||||
import org.keycloak.testsuite.rule.Page;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
@RunWith(Arquillian.class)
|
||||
public class AccountTest extends AbstractDroneTest {
|
||||
|
||||
@Page
|
||||
protected ChangePasswordPage changePasswordPage;
|
||||
|
||||
@Page
|
||||
protected UpdateProfilePage profilePage;
|
||||
|
||||
@Test
|
||||
public void changePassword() {
|
||||
appPage.open();
|
||||
loginPage.register();
|
||||
registerPage.register("name", "email", "changePassword", "password", "password");
|
||||
|
||||
changePasswordPage.open();
|
||||
changePasswordPage.changePassword("password", "new-password", "new-password");
|
||||
|
||||
appPage.open();
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
appPage.logout();
|
||||
|
||||
Assert.assertTrue(loginPage.isCurrent());
|
||||
|
||||
loginPage.login("changePassword", "password");
|
||||
|
||||
Assert.assertEquals("Invalid username or password", loginPage.getError());
|
||||
|
||||
loginPage.login("changePassword", "new-password");
|
||||
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
Assert.assertEquals("changePassword", appPage.getUser());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changeProfile() {
|
||||
appPage.open();
|
||||
loginPage.register();
|
||||
registerPage.register("first last", "old@email.com", "changeProfile", "password", "password");
|
||||
|
||||
profilePage.open();
|
||||
|
||||
Assert.assertEquals("first", profilePage.getFirstName());
|
||||
Assert.assertEquals("last", profilePage.getLastName());
|
||||
Assert.assertEquals("old@email.com", profilePage.getEmail());
|
||||
|
||||
profilePage.updateProfile("New first", "New last", "new@email.com");
|
||||
|
||||
Assert.assertEquals("New first", profilePage.getFirstName());
|
||||
Assert.assertEquals("New last", profilePage.getLastName());
|
||||
Assert.assertEquals("new@email.com", profilePage.getEmail());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.keycloak.testsuite;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class ApplicationServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
resp.getWriter().print("Hello world!");
|
||||
}
|
||||
|
||||
}
|
|
@ -2,8 +2,6 @@ package org.keycloak.testsuite;
|
|||
|
||||
public class Constants {
|
||||
|
||||
public static String APP_ROOT = "http://localhost:8080/app";
|
||||
|
||||
public static String AUTH_SERVER_ROOT = "http://localhost:8080/auth-server";
|
||||
public static String AUTH_SERVER_ROOT = "http://localhost:8081/auth-server";
|
||||
|
||||
}
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
package org.keycloak.testsuite;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.jboss.shrinkwrap.api.ShrinkWrap;
|
||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
|
||||
|
||||
public class Deployments {
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
152
testsuite/src/test/java/org/keycloak/testsuite/OAuthClient.java
Normal file
152
testsuite/src/test/java/org/keycloak/testsuite/OAuthClient.java
Normal file
|
@ -0,0 +1,152 @@
|
|||
package org.keycloak.testsuite;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.utils.URLEncodedUtils;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
public class OAuthClient {
|
||||
|
||||
private WebDriver driver;
|
||||
|
||||
private String baseUrl = "http://localhost:8081/auth-server/rest";
|
||||
|
||||
private String realm = "test";
|
||||
|
||||
private String responseType = "code";
|
||||
|
||||
private String clientId = "test-app";
|
||||
|
||||
private String redirectUri = "http://localhost:8081/app/auth";
|
||||
|
||||
private String scope;
|
||||
|
||||
private String state;
|
||||
|
||||
public OAuthClient(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
// public void login(String username, String password) throws UnsupportedEncodingException {
|
||||
// HttpClient client = new DefaultHttpClient();
|
||||
// HttpPost post = new HttpPost(getLoginFormUrl());
|
||||
//
|
||||
// List<NameValuePair> parameters = new LinkedList<NameValuePair>();
|
||||
// parameters.add(new BasicNameValuePair("username", username));
|
||||
// parameters.add(new BasicNameValuePair("password", password));
|
||||
//
|
||||
// UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(parameters, Charset.forName("UTF-8"));
|
||||
// post.setEntity(formEntity);
|
||||
// }
|
||||
|
||||
public boolean isAuthorizationResponse() {
|
||||
return getCurrentRequest().equals(redirectUri) && getCurrentQuery().containsKey("code");
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public String getResponseType() {
|
||||
return responseType;
|
||||
}
|
||||
|
||||
public String getCurrentRequest() {
|
||||
return driver.getCurrentUrl().substring(0, driver.getCurrentUrl().indexOf('?'));
|
||||
}
|
||||
|
||||
public URI getCurrentUri() {
|
||||
try {
|
||||
return new URI(driver.getCurrentUrl());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, String> getCurrentQuery() {
|
||||
Map<String, String> m = new HashMap<String, String>();
|
||||
List<NameValuePair> pairs = URLEncodedUtils.parse(getCurrentUri(), "UTF-8");
|
||||
for (NameValuePair p : pairs) {
|
||||
m.put(p.getName(), p.getValue());
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
public void openLoginForm() {
|
||||
driver.navigate().to(getLoginFormUrl());
|
||||
}
|
||||
|
||||
public void openLogout() {
|
||||
UriBuilder b = UriBuilder.fromUri(baseUrl + "/realms/" + realm + "/tokens/logout");
|
||||
if (redirectUri != null) {
|
||||
b.queryParam("redirect_uri", redirectUri);
|
||||
}
|
||||
driver.navigate().to(b.build().toString());
|
||||
}
|
||||
|
||||
public String getRedirectUri() {
|
||||
return redirectUri;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public String getLoginFormUrl() {
|
||||
UriBuilder b = UriBuilder.fromUri(baseUrl + "/realms/" + realm + "/tokens/login");
|
||||
b.queryParam("response_type", responseType);
|
||||
b.queryParam("client_id", clientId);
|
||||
if (redirectUri != null) {
|
||||
b.queryParam("redirect_uri", redirectUri);
|
||||
}
|
||||
if (scope != null) {
|
||||
b.queryParam("scope", scope);
|
||||
}
|
||||
if (state != null) {
|
||||
b.queryParam("state", state);
|
||||
}
|
||||
return b.build().toString();
|
||||
}
|
||||
|
||||
public OAuthClient realm(String realm) {
|
||||
this.realm = realm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuthClient clientId(String clientId) {
|
||||
this.clientId = clientId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuthClient redirectUri(String redirectUri) {
|
||||
this.redirectUri = redirectUri;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuthClient responseType(String responseType) {
|
||||
this.responseType = responseType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuthClient scope(String scope) {
|
||||
this.scope = scope;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OAuthClient state(String state) {
|
||||
this.state = state;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
* 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.container.test.api.Deployment;
|
||||
import org.jboss.arquillian.junit.Arquillian;
|
||||
import org.jboss.shrinkwrap.api.ShrinkWrap;
|
||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.keycloak.testsuite.pages.LoginPasswordUpdatePage;
|
||||
import org.keycloak.testsuite.rule.GreenMailRule;
|
||||
import org.keycloak.testsuite.rule.Page;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
@RunWith(Arquillian.class)
|
||||
public class RequiredActionResetPasswordTest extends AbstractDroneTest {
|
||||
|
||||
@Deployment(name = "properties", testable = false, order = 1)
|
||||
public static WebArchive propertiesDeployment() {
|
||||
return ShrinkWrap.create(WebArchive.class, "properties.war").addClass(SystemPropertiesSetter.class)
|
||||
.addAsWebInfResource("web-properties-email-verfication.xml", "web.xml");
|
||||
}
|
||||
|
||||
@Rule
|
||||
public GreenMailRule greenMail = new GreenMailRule();
|
||||
|
||||
@Page
|
||||
protected LoginPasswordUpdatePage changePasswordPage;
|
||||
|
||||
@Test
|
||||
public void tempPassword() {
|
||||
appPage.open();
|
||||
|
||||
Assert.assertTrue(loginPage.isCurrent());
|
||||
|
||||
loginPage.login("reset@pass.com", "temp-password");
|
||||
|
||||
Assert.assertTrue(changePasswordPage.isCurrent());
|
||||
|
||||
changePasswordPage.changePassword("new-password", "new-password");
|
||||
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
Assert.assertEquals("reset@pass.com", appPage.getUser());
|
||||
|
||||
appPage.logout();
|
||||
appPage.open();
|
||||
|
||||
Assert.assertTrue(loginPage.isCurrent());
|
||||
|
||||
loginPage.login("reset@pass.com", "new-password");
|
||||
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
Assert.assertEquals("reset@pass.com", appPage.getUser());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* 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.container.test.api.Deployment;
|
||||
import org.jboss.arquillian.junit.Arquillian;
|
||||
import org.jboss.shrinkwrap.api.ShrinkWrap;
|
||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.keycloak.testsuite.pages.LoginUpdateProfilePage;
|
||||
import org.keycloak.testsuite.rule.GreenMailRule;
|
||||
import org.keycloak.testsuite.rule.Page;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
@RunWith(Arquillian.class)
|
||||
public class RequiredActionUpdateProfileTest extends AbstractDroneTest {
|
||||
|
||||
@Deployment(name = "properties", testable = false, order = 1)
|
||||
public static WebArchive propertiesDeployment() {
|
||||
return ShrinkWrap.create(WebArchive.class, "properties.war").addClass(SystemPropertiesSetter.class)
|
||||
.addAsWebInfResource("web-properties-email-verfication.xml", "web.xml");
|
||||
}
|
||||
|
||||
@Rule
|
||||
public GreenMailRule greenMail = new GreenMailRule();
|
||||
|
||||
@Page
|
||||
protected LoginUpdateProfilePage updateProfilePage;
|
||||
|
||||
@Test
|
||||
public void updateProfile() {
|
||||
appPage.open();
|
||||
|
||||
Assert.assertTrue(loginPage.isCurrent());
|
||||
|
||||
loginPage.login("updateprof@pass.com", "password");
|
||||
|
||||
Assert.assertTrue(updateProfilePage.isCurrent());
|
||||
|
||||
updateProfilePage.update("New first", "New last", "new@email.com");
|
||||
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
Assert.assertEquals("updateprof@pass.com", appPage.getUser());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
package org.keycloak.testsuite;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
|
||||
public class SystemPropertiesSetter implements Servlet {
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
for (Entry<String, String> e : original.entrySet()) {
|
||||
System.setProperty(e.getKey(), e.getValue());
|
||||
System.out.println("RESET " + e.getKey() + "=" + e.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletConfig getServletConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Map<String, String> original = new HashMap<String, String>();
|
||||
|
||||
@Override
|
||||
public void init(ServletConfig arg0) throws ServletException {
|
||||
Enumeration<String> n = arg0.getInitParameterNames();
|
||||
while (n.hasMoreElements()) {
|
||||
String k = n.nextElement();
|
||||
String v = arg0.getInitParameter(k);
|
||||
|
||||
original.put(k, v);
|
||||
|
||||
System.setProperty(k, v);
|
||||
System.out.println("SET " + k + "=" + v);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void service(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException {
|
||||
}
|
||||
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
* 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 javax.servlet.ServletContext;
|
||||
import javax.ws.rs.core.Context;
|
||||
|
||||
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 <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
public class TestApplication extends KeycloakApplication {
|
||||
|
||||
public TestApplication(@Context ServletContext servletContext) {
|
||||
super(servletContext);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
* 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.keycloak.testsuite.pages.LoginTotpPage;
|
||||
import org.keycloak.testsuite.pages.TotpPage;
|
||||
import org.keycloak.testsuite.rule.Page;
|
||||
import org.picketlink.idm.credential.util.TimeBasedOTP;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
@RunWith(Arquillian.class)
|
||||
public class TotpTest extends AbstractDroneTest {
|
||||
|
||||
@Page
|
||||
private LoginTotpPage loginTotpPage;
|
||||
|
||||
private TimeBasedOTP totp;
|
||||
|
||||
@Page
|
||||
protected TotpPage totpPage;
|
||||
|
||||
@Before
|
||||
public void before() throws MalformedURLException {
|
||||
totp = new TimeBasedOTP();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loginWithTotpFailure() {
|
||||
appPage.open();
|
||||
loginPage.register();
|
||||
registerPage.register("name", "email", "loginWithTotpFailure", "password", "password");
|
||||
totpPage.open();
|
||||
|
||||
String totpSecret = totpPage.getTotpSecret();
|
||||
totpPage.configure(totp.generate(totpSecret));
|
||||
|
||||
appPage.open();
|
||||
appPage.logout();
|
||||
|
||||
loginPage.login("loginWithTotpSuccess", "password");
|
||||
|
||||
Assert.assertFalse(appPage.isCurrent());
|
||||
|
||||
loginTotpPage.login("123456");
|
||||
|
||||
Assert.assertTrue(loginTotpPage.isCurrent());
|
||||
Assert.assertEquals("Invalid username or password", loginTotpPage.getError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loginWithTotpSuccess() {
|
||||
appPage.open();
|
||||
loginPage.register();
|
||||
registerPage.register("name", "email", "loginWithTotpSuccess", "password", "password");
|
||||
totpPage.open();
|
||||
|
||||
String totpSecret = totpPage.getTotpSecret();
|
||||
totpPage.configure(totp.generate(totpSecret));
|
||||
|
||||
appPage.open();
|
||||
appPage.logout();
|
||||
|
||||
loginPage.login("loginWithTotpSuccess", "password");
|
||||
|
||||
Assert.assertFalse(appPage.isCurrent());
|
||||
|
||||
loginTotpPage.login(totp.generate(totpSecret));
|
||||
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setupTotp() {
|
||||
appPage.open();
|
||||
loginPage.register();
|
||||
registerPage.register("name", "email", "setupTotp", "password", "password");
|
||||
|
||||
totpPage.open();
|
||||
|
||||
Assert.assertTrue(totpPage.isCurrent());
|
||||
|
||||
totpPage.configure(totp.generate(totpPage.getTotpSecret()));
|
||||
|
||||
Assert.assertTrue(driver.getPageSource().contains("Google Authenticator enabled"));
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,7 @@
|
|||
* 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;
|
||||
package org.keycloak.testsuite.actions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -28,77 +28,86 @@ import java.util.regex.Pattern;
|
|||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import org.jboss.arquillian.container.test.api.Deployment;
|
||||
import org.jboss.arquillian.junit.Arquillian;
|
||||
import org.jboss.shrinkwrap.api.ShrinkWrap;
|
||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.keycloak.testsuite.pages.AppPage;
|
||||
import org.keycloak.services.managers.RealmManager;
|
||||
import org.keycloak.services.models.RealmModel;
|
||||
import org.keycloak.services.models.UserModel;
|
||||
import org.keycloak.services.models.UserModel.RequiredAction;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.pages.RegisterPage;
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.keycloak.testsuite.rule.GreenMailRule;
|
||||
import org.keycloak.testsuite.rule.Page;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule.KeycloakSetup;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
@RunWith(Arquillian.class)
|
||||
public class RequiredActionEmailVerificationTest {
|
||||
|
||||
@Deployment(name = "app", testable = false, order = 3)
|
||||
public static WebArchive appDeployment() {
|
||||
return Deployments.appDeployment();
|
||||
}
|
||||
@ClassRule
|
||||
public static KeycloakRule keycloakRule = new KeycloakRule(new KeycloakSetup() {
|
||||
|
||||
@Deployment(name = "auth-server", testable = false, order = 2)
|
||||
public static WebArchive deployment() {
|
||||
return Deployments.deployment().addAsResource("testrealm-email.json", "META-INF/testrealm.json");
|
||||
}
|
||||
@Override
|
||||
public void config(RealmManager manager, RealmModel defaultRealm, RealmModel appRealm) {
|
||||
appRealm.setVerifyEmail(true);
|
||||
|
||||
@Deployment(name = "properties", testable = false, order = 1)
|
||||
public static WebArchive propertiesDeployment() {
|
||||
return ShrinkWrap.create(WebArchive.class, "properties.war").addClass(SystemPropertiesSetter.class)
|
||||
.addAsWebInfResource("web-properties-email-verfication.xml", "web.xml");
|
||||
}
|
||||
UserModel user = appRealm.getUser("test-user@localhost");
|
||||
user.addRequiredAction(RequiredAction.VERIFY_EMAIL);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@Rule
|
||||
public WebRule webRule = new WebRule(this);
|
||||
|
||||
@Page
|
||||
protected AppPage appPage;
|
||||
|
||||
@Driver
|
||||
protected WebDriver driver;
|
||||
|
||||
@Page
|
||||
protected LoginPage loginPage;
|
||||
|
||||
@Page
|
||||
protected RegisterPage registerPage;
|
||||
|
||||
@Rule
|
||||
public GreenMailRule greenMail = new GreenMailRule();
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
appPage.open();
|
||||
if (appPage.isCurrent()) {
|
||||
appPage.logout();
|
||||
}
|
||||
@WebResource
|
||||
protected WebDriver driver;
|
||||
|
||||
@WebResource
|
||||
protected OAuthClient oauth;
|
||||
|
||||
@WebResource
|
||||
protected LoginPage loginPage;
|
||||
|
||||
@WebResource
|
||||
protected RegisterPage registerPage;
|
||||
|
||||
@Test
|
||||
public void verifyEmailExisting() throws IOException, MessagingException {
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "password");
|
||||
|
||||
Assert.assertTrue(driver.getPageSource().contains("Verify email"));
|
||||
|
||||
MimeMessage message = greenMail.getReceivedMessages()[0];
|
||||
|
||||
String body = (String) message.getContent();
|
||||
|
||||
Pattern p = Pattern.compile("(?s).*(http://[^\\s]*).*");
|
||||
Matcher m = p.matcher(body);
|
||||
m.matches();
|
||||
|
||||
String verificationUrl = m.group(1);
|
||||
|
||||
driver.navigate().to(verificationUrl.trim());
|
||||
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyEmail() throws IOException, MessagingException {
|
||||
appPage.open();
|
||||
|
||||
loginPage.register();
|
||||
public void verifyEmailRegister() throws IOException, MessagingException {
|
||||
loginPage.open();
|
||||
loginPage.clickRegister();
|
||||
registerPage.register("name", "email", "verifyEmail", "password", "password");
|
||||
|
||||
Assert.assertTrue(driver.getPageSource().contains("Verify email"));
|
||||
|
@ -115,8 +124,7 @@ public class RequiredActionEmailVerificationTest {
|
|||
|
||||
driver.navigate().to(verificationUrl.trim());
|
||||
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
Assert.assertEquals("verifyEmail", appPage.getUser());
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
}
|
||||
|
||||
}
|
|
@ -19,76 +19,81 @@
|
|||
* 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;
|
||||
package org.keycloak.testsuite.actions;
|
||||
|
||||
import org.jboss.arquillian.container.test.api.Deployment;
|
||||
import org.jboss.arquillian.junit.Arquillian;
|
||||
import org.jboss.shrinkwrap.api.ShrinkWrap;
|
||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.keycloak.services.managers.RealmManager;
|
||||
import org.keycloak.services.models.RealmModel;
|
||||
import org.keycloak.services.models.UserModel;
|
||||
import org.keycloak.services.models.UserModel.RequiredAction;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.pages.LoginPasswordUpdatePage;
|
||||
import org.keycloak.testsuite.pages.LoginUpdateProfilePage;
|
||||
import org.keycloak.testsuite.rule.GreenMailRule;
|
||||
import org.keycloak.testsuite.rule.Page;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule.KeycloakSetup;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
@RunWith(Arquillian.class)
|
||||
public class RequiredActionMultipleActionsTest extends AbstractDroneTest {
|
||||
public class RequiredActionMultipleActionsTest {
|
||||
|
||||
@Deployment(name = "properties", testable = false, order = 1)
|
||||
public static WebArchive propertiesDeployment() {
|
||||
return ShrinkWrap.create(WebArchive.class, "properties.war").addClass(SystemPropertiesSetter.class)
|
||||
.addAsWebInfResource("web-properties-email-verfication.xml", "web.xml");
|
||||
}
|
||||
@ClassRule
|
||||
public static KeycloakRule keycloakRule = new KeycloakRule(new KeycloakSetup() {
|
||||
|
||||
@Override
|
||||
public void config(RealmManager manager, RealmModel defaultRealm, RealmModel appRealm) {
|
||||
UserModel user = appRealm.getUser("test-user@localhost");
|
||||
user.addRequiredAction(RequiredAction.UPDATE_PROFILE);
|
||||
user.addRequiredAction(RequiredAction.UPDATE_PASSWORD);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@Rule
|
||||
public GreenMailRule greenMail = new GreenMailRule();
|
||||
public WebRule webRule = new WebRule(this);
|
||||
|
||||
@Page
|
||||
@WebResource
|
||||
protected WebDriver driver;
|
||||
|
||||
@WebResource
|
||||
protected OAuthClient oauth;
|
||||
|
||||
@WebResource
|
||||
protected LoginPage loginPage;
|
||||
|
||||
@WebResource
|
||||
protected LoginPasswordUpdatePage changePasswordPage;
|
||||
|
||||
@Page
|
||||
@WebResource
|
||||
protected LoginUpdateProfilePage updateProfilePage;
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
appPage.open();
|
||||
if (appPage.isCurrent()) {
|
||||
appPage.logout();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateProfileAndPassword() {
|
||||
appPage.open();
|
||||
|
||||
Assert.assertTrue(loginPage.isCurrent());
|
||||
|
||||
loginPage.login("multiple@actions.com", "temp-password");
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "password");
|
||||
|
||||
if (changePasswordPage.isCurrent()) {
|
||||
updatePassword();
|
||||
|
||||
Assert.assertTrue(updateProfilePage.isCurrent());
|
||||
updateProfilePage.assertCurrent();
|
||||
updateProfile();
|
||||
} else if (updateProfilePage.isCurrent()) {
|
||||
updateProfile();
|
||||
|
||||
Assert.assertTrue(changePasswordPage.isCurrent());
|
||||
changePasswordPage.assertCurrent();
|
||||
updatePassword();
|
||||
} else {
|
||||
Assert.fail("Expected to update password and profile before login");
|
||||
}
|
||||
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
Assert.assertEquals("multiple@actions.com", appPage.getUser());
|
||||
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
}
|
||||
|
||||
public void updatePassword() {
|
|
@ -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.actions;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.keycloak.services.managers.RealmManager;
|
||||
import org.keycloak.services.models.RealmModel;
|
||||
import org.keycloak.services.models.UserModel;
|
||||
import org.keycloak.services.models.UserModel.RequiredAction;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.pages.LoginPasswordUpdatePage;
|
||||
import org.keycloak.testsuite.rule.GreenMailRule;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule.KeycloakSetup;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
public class RequiredActionResetPasswordTest {
|
||||
|
||||
@ClassRule
|
||||
public static KeycloakRule keycloakRule = new KeycloakRule(new KeycloakSetup() {
|
||||
|
||||
@Override
|
||||
public void config(RealmManager manager, RealmModel defaultRealm, RealmModel appRealm) {
|
||||
appRealm.setResetPasswordAllowed(true);
|
||||
|
||||
UserModel user = appRealm.getUser("test-user@localhost");
|
||||
user.addRequiredAction(RequiredAction.UPDATE_PASSWORD);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@Rule
|
||||
public WebRule webRule = new WebRule(this);
|
||||
|
||||
@Rule
|
||||
public GreenMailRule greenMail = new GreenMailRule();
|
||||
|
||||
@WebResource
|
||||
protected WebDriver driver;
|
||||
|
||||
@WebResource
|
||||
protected OAuthClient oauth;
|
||||
|
||||
@WebResource
|
||||
protected LoginPage loginPage;
|
||||
|
||||
@WebResource
|
||||
protected LoginPasswordUpdatePage changePasswordPage;
|
||||
|
||||
@Test
|
||||
public void tempPassword() {
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "password");
|
||||
|
||||
changePasswordPage.assertCurrent();
|
||||
changePasswordPage.changePassword("new-password", "new-password");
|
||||
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
|
||||
oauth.openLogout();
|
||||
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "new-password");
|
||||
}
|
||||
|
||||
}
|
|
@ -19,25 +19,24 @@
|
|||
* 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;
|
||||
package org.keycloak.testsuite.actions;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import org.jboss.arquillian.container.test.api.Deployment;
|
||||
import org.jboss.arquillian.junit.Arquillian;
|
||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.keycloak.testsuite.pages.AppPage;
|
||||
import org.keycloak.representations.idm.CredentialRepresentation;
|
||||
import org.keycloak.services.managers.RealmManager;
|
||||
import org.keycloak.services.models.RealmModel;
|
||||
import org.keycloak.services.models.UserModel;
|
||||
import org.keycloak.services.models.UserModel.RequiredAction;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.pages.LoginConfigTotpPage;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.pages.RegisterPage;
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.keycloak.testsuite.rule.Page;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule.KeycloakSetup;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.picketlink.idm.credential.util.TimeBasedOTP;
|
||||
|
@ -45,65 +44,65 @@ import org.picketlink.idm.credential.util.TimeBasedOTP;
|
|||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
@RunWith(Arquillian.class)
|
||||
public class RequiredActionTotpSetupTest {
|
||||
|
||||
@Deployment(name = "app", testable = false, order = 2)
|
||||
public static WebArchive appDeployment() {
|
||||
return Deployments.appDeployment();
|
||||
}
|
||||
@ClassRule
|
||||
public static KeycloakRule keycloakRule = new KeycloakRule(new KeycloakSetup() {
|
||||
|
||||
@Deployment(name = "auth-server", testable = false, order = 1)
|
||||
public static WebArchive deployment() {
|
||||
return Deployments.deployment().addAsResource("testrealm-totp.json", "META-INF/testrealm.json");
|
||||
}
|
||||
@Override
|
||||
public void config(RealmManager manager, RealmModel defaultRealm, RealmModel appRealm) {
|
||||
appRealm.addRequiredCredential(CredentialRepresentation.TOTP);
|
||||
appRealm.setResetPasswordAllowed(true);
|
||||
|
||||
UserModel user = appRealm.getUser("test-user@localhost");
|
||||
user.addRequiredAction(RequiredAction.CONFIGURE_TOTP);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@Rule
|
||||
public WebRule webRule = new WebRule(this);
|
||||
|
||||
@Page
|
||||
protected AppPage appPage;
|
||||
|
||||
@Driver
|
||||
@WebResource
|
||||
protected WebDriver driver;
|
||||
|
||||
@Page
|
||||
protected LoginConfigTotpPage totpPage;
|
||||
@WebResource
|
||||
protected OAuthClient oauth;
|
||||
|
||||
@Page
|
||||
@WebResource
|
||||
protected LoginPage loginPage;
|
||||
|
||||
@Page
|
||||
@WebResource
|
||||
protected LoginConfigTotpPage totpPage;
|
||||
|
||||
@WebResource
|
||||
protected RegisterPage registerPage;
|
||||
|
||||
protected TimeBasedOTP totp;
|
||||
|
||||
@Before
|
||||
public void before() throws MalformedURLException {
|
||||
totp = new TimeBasedOTP();
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
appPage.open();
|
||||
if (appPage.isCurrent()) {
|
||||
appPage.logout();
|
||||
}
|
||||
}
|
||||
protected TimeBasedOTP totp = new TimeBasedOTP();
|
||||
|
||||
@Test
|
||||
public void setupTotp() {
|
||||
appPage.open();
|
||||
|
||||
loginPage.register();
|
||||
public void setupTotpRegister() {
|
||||
loginPage.open();
|
||||
loginPage.clickRegister();
|
||||
registerPage.register("name", "email", "setupTotp", "password", "password");
|
||||
|
||||
Assert.assertTrue(totpPage.isCurrent());
|
||||
totpPage.assertCurrent();
|
||||
|
||||
totpPage.configure(totp.generate(totpPage.getTotpSecret()));
|
||||
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
Assert.assertEquals("setupTotp", appPage.getUser());
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setupTotpExisting() {
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "password");
|
||||
|
||||
totpPage.assertCurrent();
|
||||
|
||||
totpPage.configure(totp.generate(totpPage.getTotpSecret()));
|
||||
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* 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.actions;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.keycloak.services.managers.RealmManager;
|
||||
import org.keycloak.services.models.RealmModel;
|
||||
import org.keycloak.services.models.UserModel;
|
||||
import org.keycloak.services.models.UserModel.RequiredAction;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.pages.LoginUpdateProfilePage;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule.KeycloakSetup;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
public class RequiredActionUpdateProfileTest {
|
||||
|
||||
@ClassRule
|
||||
public static KeycloakRule keycloakRule = new KeycloakRule(new KeycloakSetup() {
|
||||
|
||||
@Override
|
||||
public void config(RealmManager manager, RealmModel defaultRealm, RealmModel appRealm) {
|
||||
UserModel user = appRealm.getUser("test-user@localhost");
|
||||
user.addRequiredAction(RequiredAction.UPDATE_PROFILE);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@Rule
|
||||
public WebRule webRule = new WebRule(this);
|
||||
|
||||
@WebResource
|
||||
protected WebDriver driver;
|
||||
|
||||
@WebResource
|
||||
protected OAuthClient oauth;
|
||||
|
||||
@WebResource
|
||||
protected LoginPage loginPage;
|
||||
|
||||
@WebResource
|
||||
protected LoginUpdateProfilePage updateProfilePage;
|
||||
|
||||
@Test
|
||||
public void updateProfile() {
|
||||
loginPage.open();
|
||||
|
||||
loginPage.login("test-user@localhost", "password");
|
||||
|
||||
updateProfilePage.assertCurrent();
|
||||
|
||||
updateProfilePage.update("New first", "New last", "new@email.com");
|
||||
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* 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.forms;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.keycloak.representations.idm.CredentialRepresentation;
|
||||
import org.keycloak.services.managers.RealmManager;
|
||||
import org.keycloak.services.models.RealmModel;
|
||||
import org.keycloak.services.models.UserCredentialModel;
|
||||
import org.keycloak.services.models.UserModel;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.pages.AccountPasswordPage;
|
||||
import org.keycloak.testsuite.pages.AccountTotpPage;
|
||||
import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule.KeycloakSetup;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.picketlink.idm.credential.util.TimeBasedOTP;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
public class AccountTest {
|
||||
|
||||
@ClassRule
|
||||
public static KeycloakRule keycloakRule = new KeycloakRule();
|
||||
|
||||
@Rule
|
||||
public WebRule webRule = new WebRule(this);
|
||||
|
||||
@WebResource
|
||||
protected WebDriver driver;
|
||||
|
||||
@WebResource
|
||||
protected OAuthClient oauth;
|
||||
|
||||
@WebResource
|
||||
protected LoginPage loginPage;
|
||||
|
||||
@WebResource
|
||||
protected AccountPasswordPage changePasswordPage;
|
||||
|
||||
@WebResource
|
||||
protected AccountUpdateProfilePage profilePage;
|
||||
|
||||
@WebResource
|
||||
protected AccountTotpPage totpPage;
|
||||
|
||||
private TimeBasedOTP totp = new TimeBasedOTP();
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
keycloakRule.configure(new KeycloakSetup() {
|
||||
@Override
|
||||
public void config(RealmManager manager, RealmModel defaultRealm, RealmModel appRealm) {
|
||||
UserModel user = appRealm.getUser("test-user@localhost");
|
||||
|
||||
UserCredentialModel cred = new UserCredentialModel();
|
||||
cred.setType(CredentialRepresentation.PASSWORD);
|
||||
cred.setValue("password");
|
||||
|
||||
appRealm.updateCredential(user, cred);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changePassword() {
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "password");
|
||||
|
||||
changePasswordPage.open();
|
||||
changePasswordPage.changePassword("password", "new-password", "new-password");
|
||||
|
||||
oauth.openLogout();
|
||||
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "password");
|
||||
|
||||
Assert.assertEquals("Invalid username or password", loginPage.getError());
|
||||
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "new-password");
|
||||
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changeProfile() {
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "password");
|
||||
|
||||
profilePage.open();
|
||||
|
||||
Assert.assertEquals("", profilePage.getFirstName());
|
||||
Assert.assertEquals("", profilePage.getLastName());
|
||||
Assert.assertEquals("test-user@localhost", profilePage.getEmail());
|
||||
|
||||
profilePage.updateProfile("New first", "New last", "new@email.com");
|
||||
|
||||
Assert.assertEquals("New first", profilePage.getFirstName());
|
||||
Assert.assertEquals("New last", profilePage.getLastName());
|
||||
Assert.assertEquals("new@email.com", profilePage.getEmail());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setupTotp() {
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "password");
|
||||
|
||||
totpPage.open();
|
||||
|
||||
Assert.assertTrue(totpPage.isCurrent());
|
||||
|
||||
totpPage.configure(totp.generate(totpPage.getTotpSecret()));
|
||||
|
||||
Assert.assertTrue(driver.getPageSource().contains("Google Authenticator enabled"));
|
||||
}
|
||||
|
||||
}
|
|
@ -19,56 +19,65 @@
|
|||
* 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;
|
||||
package org.keycloak.testsuite.forms;
|
||||
|
||||
import org.jboss.arquillian.junit.Arquillian;
|
||||
import org.junit.Assert;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
@RunWith(Arquillian.class)
|
||||
public class LoginTest extends AbstractDroneTest {
|
||||
public class LoginTest {
|
||||
|
||||
@ClassRule
|
||||
public static KeycloakRule keycloakRule = new KeycloakRule();
|
||||
|
||||
@Rule
|
||||
public WebRule webRule = new WebRule(this);
|
||||
|
||||
@WebResource
|
||||
protected WebDriver driver;
|
||||
|
||||
@WebResource
|
||||
protected OAuthClient oauth;
|
||||
|
||||
@WebResource
|
||||
protected LoginPage loginPage;
|
||||
|
||||
@Test
|
||||
public void loginInvalidPassword() {
|
||||
appPage.open();
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "invalid");
|
||||
|
||||
Assert.assertTrue(loginPage.isCurrent());
|
||||
loginPage.login("bburke@redhat.com", "invalid");
|
||||
loginPage.assertCurrent();
|
||||
|
||||
Assert.assertEquals("Invalid username or password", loginPage.getError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loginInvalidUsername() {
|
||||
appPage.open();
|
||||
|
||||
Assert.assertTrue(loginPage.isCurrent());
|
||||
loginPage.open();
|
||||
loginPage.login("invalid", "password");
|
||||
|
||||
loginPage.assertCurrent();
|
||||
|
||||
Assert.assertEquals("Invalid username or password", loginPage.getError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loginSuccess() {
|
||||
appPage.open();
|
||||
|
||||
loginPage.login("bburke@redhat.com", "password");
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "password");
|
||||
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
Assert.assertEquals("bburke@redhat.com", appPage.getUser());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void logout() {
|
||||
loginSuccess();
|
||||
appPage.logout();
|
||||
|
||||
appPage.open();
|
||||
Assert.assertTrue(loginPage.isCurrent());
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* 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.forms;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.keycloak.representations.idm.CredentialRepresentation;
|
||||
import org.keycloak.services.managers.RealmManager;
|
||||
import org.keycloak.services.models.RealmModel;
|
||||
import org.keycloak.services.models.UserCredentialModel;
|
||||
import org.keycloak.services.models.UserModel;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.pages.LoginTotpPage;
|
||||
import org.keycloak.testsuite.rule.GreenMailRule;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule.KeycloakSetup;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.picketlink.idm.credential.util.TimeBasedOTP;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
public class LoginTotpTest {
|
||||
|
||||
@ClassRule
|
||||
public static KeycloakRule keycloakRule = new KeycloakRule(new KeycloakSetup() {
|
||||
|
||||
@Override
|
||||
public void config(RealmManager manager, RealmModel defaultRealm, RealmModel appRealm) {
|
||||
UserModel user = appRealm.getUser("test-user@localhost");
|
||||
|
||||
UserCredentialModel credentials = new UserCredentialModel();
|
||||
credentials.setType(CredentialRepresentation.TOTP);
|
||||
credentials.setValue("totpSecret");
|
||||
appRealm.updateCredential(user, credentials);
|
||||
|
||||
user.setTotp(true);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@Rule
|
||||
public WebRule webRule = new WebRule(this);
|
||||
|
||||
@Rule
|
||||
public GreenMailRule greenMail = new GreenMailRule();
|
||||
|
||||
@WebResource
|
||||
protected WebDriver driver;
|
||||
|
||||
@WebResource
|
||||
protected OAuthClient oauth;
|
||||
|
||||
@WebResource
|
||||
protected LoginPage loginPage;
|
||||
|
||||
@WebResource
|
||||
private LoginTotpPage loginTotpPage;
|
||||
|
||||
private TimeBasedOTP totp = new TimeBasedOTP();
|
||||
|
||||
@Before
|
||||
public void before() throws MalformedURLException {
|
||||
totp = new TimeBasedOTP();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loginWithTotpFailure() {
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "password");
|
||||
|
||||
loginTotpPage.assertCurrent();
|
||||
|
||||
loginTotpPage.login("123456");
|
||||
|
||||
loginPage.assertCurrent();
|
||||
Assert.assertEquals("Invalid username or password", loginPage.getError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loginWithTotpSuccess() {
|
||||
loginPage.open();
|
||||
loginPage.login("test-user@localhost", "password");
|
||||
|
||||
loginTotpPage.assertCurrent();
|
||||
|
||||
loginTotpPage.login(totp.generate("totpSecret"));
|
||||
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
}
|
||||
|
||||
}
|
|
@ -19,80 +19,100 @@
|
|||
* 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;
|
||||
package org.keycloak.testsuite.forms;
|
||||
|
||||
import org.jboss.arquillian.junit.Arquillian;
|
||||
import org.junit.Assert;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.pages.RegisterPage;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
@RunWith(Arquillian.class)
|
||||
public class RegisterTest extends AbstractDroneTest {
|
||||
public class RegisterTest {
|
||||
|
||||
@ClassRule
|
||||
public static KeycloakRule keycloakRule = new KeycloakRule();
|
||||
|
||||
@Rule
|
||||
public WebRule webRule = new WebRule(this);
|
||||
|
||||
@WebResource
|
||||
protected WebDriver driver;
|
||||
|
||||
@WebResource
|
||||
protected OAuthClient oauth;
|
||||
|
||||
@WebResource
|
||||
protected LoginPage loginPage;
|
||||
|
||||
@WebResource
|
||||
protected RegisterPage registerPage;
|
||||
|
||||
@Test
|
||||
public void registerExistingUser() {
|
||||
appPage.open();
|
||||
loginPage.register();
|
||||
loginPage.open();
|
||||
loginPage.clickRegister();
|
||||
registerPage.assertCurrent();
|
||||
|
||||
Assert.assertTrue(registerPage.isCurrent());
|
||||
registerPage.register("name", "email", "test-user@localhost", "password", "password");
|
||||
|
||||
registerPage.register("name", "email", "registerExistingUser", null, null);
|
||||
|
||||
Assert.assertTrue(registerPage.isCurrent());
|
||||
Assert.assertEquals("Please specify password", registerPage.getError());
|
||||
registerPage.assertCurrent();
|
||||
Assert.assertEquals("Username already exists", registerPage.getError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registerUserInvalidPasswordConfirm() {
|
||||
appPage.open();
|
||||
loginPage.register();
|
||||
|
||||
Assert.assertTrue(registerPage.isCurrent());
|
||||
loginPage.open();
|
||||
loginPage.clickRegister();
|
||||
registerPage.assertCurrent();
|
||||
|
||||
registerPage.register("name", "email", "registerUserInvalidPasswordConfirm", "password", "invalid");
|
||||
|
||||
Assert.assertTrue(registerPage.isCurrent());
|
||||
registerPage.assertCurrent();
|
||||
Assert.assertEquals("Password confirmation doesn't match", registerPage.getError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registerUserMissingPassword() {
|
||||
appPage.open();
|
||||
loginPage.register();
|
||||
|
||||
Assert.assertTrue(registerPage.isCurrent());
|
||||
loginPage.open();
|
||||
loginPage.clickRegister();
|
||||
registerPage.assertCurrent();
|
||||
|
||||
registerPage.register("name", "email", "registerUserMissingPassword", null, null);
|
||||
|
||||
Assert.assertTrue(registerPage.isCurrent());
|
||||
registerPage.assertCurrent();
|
||||
Assert.assertEquals("Please specify password", registerPage.getError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registerUserMissingUsername() {
|
||||
appPage.open();
|
||||
loginPage.register();
|
||||
|
||||
Assert.assertTrue(registerPage.isCurrent());
|
||||
loginPage.open();
|
||||
loginPage.clickRegister();
|
||||
registerPage.assertCurrent();
|
||||
|
||||
registerPage.register("name", "email", null, "password", "password");
|
||||
|
||||
Assert.assertTrue(registerPage.isCurrent());
|
||||
registerPage.assertCurrent();
|
||||
Assert.assertEquals("Please specify username", registerPage.getError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registerUserSuccess() {
|
||||
appPage.open();
|
||||
loginPage.register();
|
||||
|
||||
Assert.assertTrue(registerPage.isCurrent());
|
||||
loginPage.open();
|
||||
loginPage.clickRegister();
|
||||
registerPage.assertCurrent();
|
||||
|
||||
registerPage.register("name", "email", "registerUserSuccess", "password", "password");
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
}
|
||||
|
||||
}
|
|
@ -19,60 +19,66 @@
|
|||
* 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;
|
||||
package org.keycloak.testsuite.forms;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import org.jboss.arquillian.container.test.api.Deployment;
|
||||
import org.jboss.arquillian.junit.Arquillian;
|
||||
import org.jboss.shrinkwrap.api.ShrinkWrap;
|
||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||
import org.junit.Assert;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
import org.keycloak.testsuite.pages.LoginPasswordResetPage;
|
||||
import org.keycloak.testsuite.pages.LoginPasswordUpdatePage;
|
||||
import org.keycloak.testsuite.rule.GreenMailRule;
|
||||
import org.keycloak.testsuite.rule.Page;
|
||||
import org.keycloak.testsuite.rule.KeycloakRule;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.keycloak.testsuite.rule.WebRule;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
@RunWith(Arquillian.class)
|
||||
public class ResetPasswordTest extends AbstractDroneTest {
|
||||
public class ResetPasswordTest {
|
||||
|
||||
@Deployment(name = "properties", testable = false, order = 1)
|
||||
public static WebArchive propertiesDeployment() {
|
||||
return ShrinkWrap.create(WebArchive.class, "properties.war").addClass(SystemPropertiesSetter.class)
|
||||
.addAsWebInfResource("web-properties-email-verfication.xml", "web.xml");
|
||||
}
|
||||
@ClassRule
|
||||
public static KeycloakRule keycloakRule = new KeycloakRule();
|
||||
|
||||
@Rule
|
||||
public WebRule webRule = new WebRule(this);
|
||||
|
||||
@Rule
|
||||
public GreenMailRule greenMail = new GreenMailRule();
|
||||
|
||||
@Page
|
||||
@WebResource
|
||||
protected WebDriver driver;
|
||||
|
||||
@WebResource
|
||||
protected OAuthClient oauth;
|
||||
|
||||
@WebResource
|
||||
protected LoginPage loginPage;
|
||||
|
||||
@WebResource
|
||||
protected LoginPasswordResetPage resetPasswordPage;
|
||||
|
||||
@Page
|
||||
@WebResource
|
||||
protected LoginPasswordUpdatePage updatePasswordPage;
|
||||
|
||||
@Test
|
||||
public void resetPassword() throws IOException, MessagingException {
|
||||
appPage.open();
|
||||
|
||||
Assert.assertTrue(loginPage.isCurrent());
|
||||
|
||||
loginPage.open();
|
||||
loginPage.resetPassword();
|
||||
|
||||
Assert.assertTrue(resetPasswordPage.isCurrent());
|
||||
resetPasswordPage.assertCurrent();
|
||||
|
||||
resetPasswordPage.changePassword("bburke@redhat.com", "bburke@redhat.com");
|
||||
resetPasswordPage.changePassword("test-user@localhost", "test-user@localhost");
|
||||
|
||||
Assert.assertTrue(resetPasswordPage.isCurrent());
|
||||
resetPasswordPage.assertCurrent();
|
||||
|
||||
Assert.assertEquals(1, greenMail.getReceivedMessages().length);
|
||||
|
||||
|
@ -83,22 +89,19 @@ public class ResetPasswordTest extends AbstractDroneTest {
|
|||
|
||||
driver.navigate().to(changePasswordUrl.trim());
|
||||
|
||||
Assert.assertTrue(updatePasswordPage.isCurrent());
|
||||
updatePasswordPage.assertCurrent();
|
||||
|
||||
updatePasswordPage.changePassword("new-password", "new-password");
|
||||
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
Assert.assertEquals("bburke@redhat.com", appPage.getUser());
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
|
||||
appPage.logout();
|
||||
appPage.open();
|
||||
oauth.openLogout();
|
||||
|
||||
Assert.assertTrue(loginPage.isCurrent());
|
||||
loginPage.open();
|
||||
|
||||
loginPage.login("bburke@redhat.com", "new-password");
|
||||
loginPage.login("test-user@localhost", "new-password");
|
||||
|
||||
Assert.assertTrue(appPage.isCurrent());
|
||||
Assert.assertEquals("bburke@redhat.com", appPage.getUser());
|
||||
Assert.assertTrue("Expected authorization response", oauth.isAuthorizationResponse());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,16 +1,16 @@
|
|||
package org.keycloak.testsuite.pages;
|
||||
|
||||
import org.keycloak.testsuite.Constants;
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class ChangePasswordPage {
|
||||
public class AccountPasswordPage extends Page {
|
||||
|
||||
private static String PATH = Constants.AUTH_SERVER_ROOT + "/rest/realms/demo/account/password";
|
||||
private static String PATH = Constants.AUTH_SERVER_ROOT + "/rest/realms/test/account/password";
|
||||
|
||||
@Driver
|
||||
@WebResource
|
||||
private WebDriver browser;
|
||||
|
||||
@FindBy(id = "password")
|
|
@ -1,16 +1,16 @@
|
|||
package org.keycloak.testsuite.pages;
|
||||
|
||||
import org.keycloak.testsuite.Constants;
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class TotpPage {
|
||||
public class AccountTotpPage extends Page {
|
||||
|
||||
private static String PATH = Constants.AUTH_SERVER_ROOT + "/rest/realms/demo/account/totp";
|
||||
private static String PATH = Constants.AUTH_SERVER_ROOT + "/rest/realms/test/account/totp";
|
||||
|
||||
@Driver
|
||||
@WebResource
|
||||
private WebDriver browser;
|
||||
|
||||
@FindBy(id = "totpSecret")
|
|
@ -1,16 +1,16 @@
|
|||
package org.keycloak.testsuite.pages;
|
||||
|
||||
import org.keycloak.testsuite.Constants;
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class UpdateProfilePage {
|
||||
public class AccountUpdateProfilePage extends Page {
|
||||
|
||||
private static String PATH = Constants.AUTH_SERVER_ROOT + "/rest/realms/demo/account";
|
||||
private static String PATH = Constants.AUTH_SERVER_ROOT + "/rest/realms/test/account";
|
||||
|
||||
@Driver
|
||||
@WebResource
|
||||
private WebDriver browser;
|
||||
|
||||
@FindBy(id = "firstName")
|
|
@ -1,38 +0,0 @@
|
|||
package org.keycloak.testsuite.pages;
|
||||
|
||||
import org.keycloak.testsuite.Constants;
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class AppPage {
|
||||
|
||||
private static String PATH = Constants.APP_ROOT + "/user.jsp";
|
||||
|
||||
@Driver
|
||||
private WebDriver browser;
|
||||
|
||||
@FindBy(id = "logout")
|
||||
private WebElement logoutLink;
|
||||
|
||||
@FindBy(id = "user")
|
||||
private WebElement user;
|
||||
|
||||
public void open() {
|
||||
browser.navigate().to(PATH);
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user.getText();
|
||||
}
|
||||
|
||||
public boolean isCurrent() {
|
||||
return browser.getCurrentUrl().equals(PATH);
|
||||
}
|
||||
|
||||
public void logout() {
|
||||
logoutLink.click();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,16 +1,13 @@
|
|||
package org.keycloak.testsuite.pages;
|
||||
|
||||
import org.keycloak.testsuite.Constants;
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class LoginConfigTotpPage {
|
||||
public class LoginConfigTotpPage extends Page {
|
||||
|
||||
private static String PATH = Constants.AUTH_SERVER_ROOT + "/rest/realms/demo/account/totp";
|
||||
|
||||
@Driver
|
||||
@WebResource
|
||||
private WebDriver browser;
|
||||
|
||||
@FindBy(id = "totpSecret")
|
||||
|
@ -36,7 +33,7 @@ public class LoginConfigTotpPage {
|
|||
}
|
||||
|
||||
public void open() {
|
||||
browser.navigate().to(PATH);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
package org.keycloak.testsuite.pages;
|
||||
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class LoginPage {
|
||||
|
||||
@Driver
|
||||
private WebDriver browser;
|
||||
public class LoginPage extends Page {
|
||||
|
||||
@FindBy(id = "username")
|
||||
private WebElement usernameInput;
|
||||
|
@ -43,10 +38,10 @@ public class LoginPage {
|
|||
}
|
||||
|
||||
public boolean isCurrent() {
|
||||
return browser.getTitle().equals("Log in to demo");
|
||||
return driver.getTitle().equals("Log in to test");
|
||||
}
|
||||
|
||||
public void register() {
|
||||
public void clickRegister() {
|
||||
registerLink.click();
|
||||
}
|
||||
|
||||
|
@ -54,4 +49,10 @@ public class LoginPage {
|
|||
resetPasswordLink.click();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
oauth.openLoginForm();
|
||||
assertCurrent();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
package org.keycloak.testsuite.pages;
|
||||
|
||||
import org.keycloak.testsuite.Constants;
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class LoginPasswordResetPage {
|
||||
public class LoginPasswordResetPage extends Page {
|
||||
|
||||
private static String PATH = Constants.AUTH_SERVER_ROOT + "/rest/realms/demo/account/password";
|
||||
|
||||
@Driver
|
||||
@WebResource
|
||||
private WebDriver browser;
|
||||
|
||||
@FindBy(id = "username")
|
||||
|
@ -34,7 +31,7 @@ public class LoginPasswordResetPage {
|
|||
}
|
||||
|
||||
public void open() {
|
||||
browser.navigate().to(PATH);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
package org.keycloak.testsuite.pages;
|
||||
|
||||
import org.keycloak.testsuite.Constants;
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class LoginPasswordUpdatePage {
|
||||
public class LoginPasswordUpdatePage extends Page {
|
||||
|
||||
private static String PATH = Constants.AUTH_SERVER_ROOT + "/rest/realms/demo/account/password";
|
||||
|
||||
@Driver
|
||||
@WebResource
|
||||
private WebDriver browser;
|
||||
|
||||
@FindBy(id = "password-new")
|
||||
|
@ -34,7 +31,7 @@ public class LoginPasswordUpdatePage {
|
|||
}
|
||||
|
||||
public void open() {
|
||||
browser.navigate().to(PATH);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package org.keycloak.testsuite.pages;
|
||||
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class LoginTotpPage {
|
||||
public class LoginTotpPage extends Page {
|
||||
|
||||
@Driver
|
||||
@WebResource
|
||||
private WebDriver browser;
|
||||
|
||||
@FindBy(id = "totp")
|
||||
|
@ -16,9 +17,6 @@ public class LoginTotpPage {
|
|||
@FindBy(css = "input[type=\"submit\"]")
|
||||
private WebElement submitButton;
|
||||
|
||||
@FindBy(linkText = "Register")
|
||||
private WebElement registerLink;
|
||||
|
||||
@FindBy(id = "loginError")
|
||||
private WebElement loginErrorMessage;
|
||||
|
||||
|
@ -33,7 +31,19 @@ public class LoginTotpPage {
|
|||
}
|
||||
|
||||
public boolean isCurrent() {
|
||||
return browser.getTitle().equals("Log in to demo");
|
||||
if (browser.getTitle().equals("Log in to test")) {
|
||||
try {
|
||||
browser.findElement(By.id("totp"));
|
||||
return true;
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package org.keycloak.testsuite.pages;
|
||||
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class LoginUpdateProfilePage {
|
||||
public class LoginUpdateProfilePage extends Page {
|
||||
|
||||
@Driver
|
||||
@WebResource
|
||||
private WebDriver browser;
|
||||
|
||||
@FindBy(id = "firstName")
|
||||
|
@ -26,8 +26,11 @@ public class LoginUpdateProfilePage {
|
|||
private WebElement loginErrorMessage;
|
||||
|
||||
public void update(String firstName, String lastName, String email) {
|
||||
firstNameInput.clear();
|
||||
firstNameInput.sendKeys(firstName);
|
||||
lastNameInput.clear();
|
||||
lastNameInput.sendKeys(lastName);
|
||||
emailInput.clear();
|
||||
emailInput.sendKeys(email);
|
||||
|
||||
submitButton.click();
|
||||
|
@ -41,4 +44,9 @@ public class LoginUpdateProfilePage {
|
|||
return browser.getTitle().equals("Update profile");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.keycloak.testsuite.pages;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
public abstract class Page {
|
||||
|
||||
@WebResource
|
||||
protected WebDriver driver;
|
||||
|
||||
@WebResource
|
||||
protected OAuthClient oauth;
|
||||
|
||||
public void assertCurrent() {
|
||||
String name = getClass().getSimpleName();
|
||||
Assert.assertTrue("Exptected " + name + " but was " + driver.getTitle() + " (" + driver.getCurrentUrl() + ")",
|
||||
isCurrent());
|
||||
}
|
||||
|
||||
abstract boolean isCurrent();
|
||||
|
||||
abstract void open();
|
||||
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
package org.keycloak.testsuite.pages;
|
||||
|
||||
import org.keycloak.testsuite.rule.Driver;
|
||||
import org.keycloak.testsuite.rule.WebResource;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
public class RegisterPage {
|
||||
public class RegisterPage extends Page {
|
||||
|
||||
@Driver
|
||||
@WebResource
|
||||
private WebDriver browser;
|
||||
|
||||
@FindBy(id = "name")
|
||||
|
@ -60,7 +60,12 @@ public class RegisterPage {
|
|||
}
|
||||
|
||||
public boolean isCurrent() {
|
||||
return browser.getTitle().equals("Register with demo");
|
||||
return browser.getTitle().equals("Register with test");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@ package org.keycloak.testsuite.rule;
|
|||
|
||||
import java.lang.Thread.UncaughtExceptionHandler;
|
||||
import java.net.SocketException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
|
@ -14,8 +17,23 @@ public class GreenMailRule extends ExternalResource {
|
|||
|
||||
private GreenMail greenMail;
|
||||
|
||||
private Properties originalProperties = new Properties();
|
||||
|
||||
@Override
|
||||
protected void before() throws Throwable {
|
||||
Iterator<Entry<Object, Object>> itr = System.getProperties().entrySet().iterator();
|
||||
while (itr.hasNext()) {
|
||||
Entry<Object, Object> e = itr.next();
|
||||
if (((String) e.getKey()).startsWith("keycloak.mail")) {
|
||||
originalProperties.put(e.getKey(), e.getValue());
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
|
||||
System.setProperty("keycloak.mail.smtp.from", "auto@keycloak.org");
|
||||
System.setProperty("keycloak.mail.smtp.host", "localhost");
|
||||
System.setProperty("keycloak.mail.smtp.port", "3025");
|
||||
|
||||
ServerSetup setup = new ServerSetup(3025, "localhost", "smtp");
|
||||
|
||||
greenMail = new GreenMail(setup);
|
||||
|
@ -39,6 +57,11 @@ public class GreenMailRule extends ExternalResource {
|
|||
|
||||
greenMail.stop();
|
||||
}
|
||||
|
||||
System.getProperties().remove("keycloak.mail.smtp.from");
|
||||
System.getProperties().remove("keycloak.mail.smtp.host");
|
||||
System.getProperties().remove("keycloak.mail.smtp.port");
|
||||
System.getProperties().putAll(originalProperties);
|
||||
}
|
||||
|
||||
public MimeMessage[] getReceivedMessages() {
|
||||
|
|
|
@ -0,0 +1,179 @@
|
|||
package org.keycloak.testsuite.rule;
|
||||
|
||||
import io.undertow.server.handlers.resource.ClassPathResourceManager;
|
||||
import io.undertow.servlet.Servlets;
|
||||
import io.undertow.servlet.api.DeploymentInfo;
|
||||
import io.undertow.servlet.api.FilterInfo;
|
||||
import io.undertow.servlet.api.ServletInfo;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.servlet.DispatcherType;
|
||||
|
||||
import org.jboss.resteasy.jwt.JsonSerialization;
|
||||
import org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer;
|
||||
import org.jboss.resteasy.spi.ResteasyDeployment;
|
||||
import org.junit.rules.ExternalResource;
|
||||
import org.keycloak.representations.idm.CredentialRepresentation;
|
||||
import org.keycloak.representations.idm.RealmRepresentation;
|
||||
import org.keycloak.services.filters.KeycloakSessionServletFilter;
|
||||
import org.keycloak.services.managers.RealmManager;
|
||||
import org.keycloak.services.models.KeycloakSession;
|
||||
import org.keycloak.services.models.KeycloakSessionFactory;
|
||||
import org.keycloak.services.models.RealmModel;
|
||||
import org.keycloak.services.models.RoleModel;
|
||||
import org.keycloak.services.models.UserModel;
|
||||
import org.keycloak.services.resources.KeycloakApplication;
|
||||
import org.keycloak.services.resources.SaasService;
|
||||
import org.keycloak.testsuite.ApplicationServlet;
|
||||
|
||||
public class KeycloakRule extends ExternalResource {
|
||||
|
||||
private String testRealm = "testrealm.json";
|
||||
|
||||
private UndertowJaxrsServer server;
|
||||
private KeycloakSessionFactory factory;
|
||||
|
||||
private KeycloakSetup setup;
|
||||
|
||||
public KeycloakRule() {
|
||||
}
|
||||
|
||||
public KeycloakRule(String testRealm) {
|
||||
this.testRealm = testRealm;
|
||||
}
|
||||
|
||||
public KeycloakRule(KeycloakSetup setup) {
|
||||
this.setup = setup;
|
||||
}
|
||||
|
||||
protected void before() throws Throwable {
|
||||
ResteasyDeployment deployment = new ResteasyDeployment();
|
||||
deployment.setApplicationClass(KeycloakApplication.class.getName());
|
||||
server = new UndertowJaxrsServer().start();
|
||||
|
||||
DeploymentInfo di = server.undertowDeployment(deployment, "rest");
|
||||
di.setClassLoader(getClass().getClassLoader());
|
||||
di.setContextPath("/auth-server");
|
||||
di.setDeploymentName("Keycloak");
|
||||
di.setResourceManager(new ClassPathResourceManager(getClass().getClassLoader(), "META-INF/resources"));
|
||||
|
||||
FilterInfo filter = Servlets.filter("SessionFilter", KeycloakSessionServletFilter.class);
|
||||
di.addFilter(filter);
|
||||
di.addFilterUrlMapping("SessionFilter", "/rest/*", DispatcherType.REQUEST);
|
||||
|
||||
server.deploy(di);
|
||||
|
||||
factory = KeycloakApplication.buildSessionFactory();
|
||||
|
||||
setupDefaultRealm();
|
||||
|
||||
importRealm(testRealm);
|
||||
|
||||
if (setup != null) {
|
||||
configure(setup);
|
||||
}
|
||||
|
||||
DeploymentInfo deploymentInfo = new DeploymentInfo();
|
||||
deploymentInfo.setClassLoader(getClass().getClassLoader());
|
||||
deploymentInfo.setDeploymentName("app");
|
||||
deploymentInfo.setContextPath("/app");
|
||||
|
||||
ServletInfo servlet = new ServletInfo(ApplicationServlet.class.getSimpleName(), ApplicationServlet.class);
|
||||
servlet.addMapping("/*");
|
||||
|
||||
deploymentInfo.addServlet(servlet);
|
||||
server.deploy(deploymentInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void after() {
|
||||
factory.close();
|
||||
server.stop();
|
||||
}
|
||||
|
||||
public RealmRepresentation loadJson(String path) throws IOException {
|
||||
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
int c;
|
||||
while ((c = is.read()) != -1) {
|
||||
os.write(c);
|
||||
}
|
||||
byte[] bytes = os.toByteArray();
|
||||
System.out.println(new String(bytes));
|
||||
|
||||
return JsonSerialization.fromBytes(RealmRepresentation.class, bytes);
|
||||
}
|
||||
|
||||
public void setupDefaultRealm() {
|
||||
KeycloakSession session = createSession();
|
||||
session.getTransaction().begin();
|
||||
|
||||
RealmManager manager = new RealmManager(session);
|
||||
|
||||
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.setAccessCodeLifespanUserAction(600);
|
||||
defaultRealm.setSslNotRequired(false);
|
||||
defaultRealm.setCookieLoginAllowed(true);
|
||||
defaultRealm.setRegistrationAllowed(true);
|
||||
defaultRealm.setAutomaticRegistrationAfterSocialLogin(false);
|
||||
manager.generateRealmKeys(defaultRealm);
|
||||
defaultRealm.addRequiredCredential(CredentialRepresentation.PASSWORD);
|
||||
RoleModel role = defaultRealm.addRole(SaasService.REALM_CREATOR_ROLE);
|
||||
UserModel admin = defaultRealm.addUser("admin");
|
||||
defaultRealm.grantRole(admin, role);
|
||||
|
||||
session.getTransaction().commit();
|
||||
session.close();
|
||||
}
|
||||
|
||||
public void importRealm(String name) throws IOException {
|
||||
KeycloakSession session = createSession();
|
||||
session.getTransaction().begin();
|
||||
|
||||
RealmManager manager = new RealmManager(session);
|
||||
|
||||
RealmModel defaultRealm = manager.getRealm(RealmModel.DEFAULT_REALM);
|
||||
UserModel admin = defaultRealm.getUser("admin");
|
||||
|
||||
RealmRepresentation rep = loadJson(name);
|
||||
RealmModel realm = manager.createRealm("test", rep.getRealm());
|
||||
manager.importRealm(rep, realm);
|
||||
realm.addRealmAdmin(admin);
|
||||
|
||||
session.getTransaction().commit();
|
||||
session.close();
|
||||
}
|
||||
|
||||
public void configure(KeycloakSetup configurer) {
|
||||
KeycloakSession session = createSession();
|
||||
session.getTransaction().begin();
|
||||
|
||||
RealmManager manager = new RealmManager(session);
|
||||
|
||||
RealmModel defaultRealm = manager.getRealm(RealmModel.DEFAULT_REALM);
|
||||
RealmModel appRealm = manager.getRealm("test");
|
||||
|
||||
configurer.config(manager, defaultRealm, appRealm);
|
||||
|
||||
session.getTransaction().commit();
|
||||
session.close();
|
||||
}
|
||||
|
||||
public KeycloakSession createSession() {
|
||||
return factory.createSession();
|
||||
}
|
||||
|
||||
public interface KeycloakSetup {
|
||||
|
||||
void config(RealmManager manager, RealmModel defaultRealm, RealmModel appRealm);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package org.keycloak.testsuite.rule;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Page {
|
||||
|
||||
}
|
|
@ -7,6 +7,5 @@ import java.lang.annotation.Target;
|
|||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Driver {
|
||||
|
||||
public @interface WebResource {
|
||||
}
|
|
@ -3,6 +3,8 @@ package org.keycloak.testsuite.rule;
|
|||
import java.lang.reflect.Field;
|
||||
|
||||
import org.junit.rules.ExternalResource;
|
||||
import org.keycloak.testsuite.OAuthClient;
|
||||
import org.keycloak.testsuite.pages.Page;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
|
@ -13,6 +15,7 @@ import com.gargoylesoftware.htmlunit.WebClient;
|
|||
public class WebRule extends ExternalResource {
|
||||
|
||||
private WebDriver driver;
|
||||
private OAuthClient oauth;
|
||||
private Object test;
|
||||
|
||||
public WebRule(Object test) {
|
||||
|
@ -28,7 +31,7 @@ public class WebRule extends ExternalResource {
|
|||
|
||||
if (browser.equals("htmlunit")) {
|
||||
HtmlUnitDriver d = new HtmlUnitDriver();
|
||||
d.getWebClient().setCssEnabled(false);
|
||||
d.getWebClient().getOptions().setCssEnabled(false);
|
||||
driver = d;
|
||||
} else if (browser.equals("chrome")) {
|
||||
driver = new ChromeDriver();
|
||||
|
@ -38,29 +41,26 @@ public class WebRule extends ExternalResource {
|
|||
throw new RuntimeException("Unsupported browser " + browser);
|
||||
}
|
||||
|
||||
initDriver(test);
|
||||
initPages(test);
|
||||
oauth = new OAuthClient(driver);
|
||||
|
||||
initWebResources(test);
|
||||
}
|
||||
|
||||
protected void initDriver(Object o) {
|
||||
protected void initWebResources(Object o) {
|
||||
Class<?> c = o.getClass();
|
||||
while (c != null) {
|
||||
for (Field f : c.getDeclaredFields()) {
|
||||
if (f.getAnnotation(Driver.class) != null) {
|
||||
set(f, o, driver);
|
||||
}
|
||||
}
|
||||
|
||||
c = c.getSuperclass();
|
||||
}
|
||||
}
|
||||
|
||||
protected void initPages(Object o) {
|
||||
Class<?> c = o.getClass();
|
||||
while (c != null) {
|
||||
for (Field f : c.getDeclaredFields()) {
|
||||
if (f.getAnnotation(Page.class) != null) {
|
||||
set(f, o, getPage(f.getType()));
|
||||
if (f.getAnnotation(WebResource.class) != null) {
|
||||
Class<?> type = f.getType();
|
||||
if (type.equals(WebDriver.class)) {
|
||||
set(f, o, driver);
|
||||
} else if (Page.class.isAssignableFrom(type)) {
|
||||
set(f, o, getPage(f.getType()));
|
||||
} else if (type.equals(OAuthClient.class)) {
|
||||
set(f, o, oauth);
|
||||
} else {
|
||||
throw new RuntimeException("Unsupported type " + f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class WebRule extends ExternalResource {
|
|||
public <T> T getPage(Class<T> pageClass) {
|
||||
try {
|
||||
T instance = pageClass.newInstance();
|
||||
initDriver(instance);
|
||||
initWebResources(instance);
|
||||
PageFactory.initElements(driver, instance);
|
||||
return instance;
|
||||
} catch (Exception e) {
|
||||
|
@ -94,6 +94,7 @@ public class WebRule extends ExternalResource {
|
|||
|
||||
@Override
|
||||
protected void after() {
|
||||
driver.manage().deleteAllCookies();
|
||||
driver.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
|
||||
version="1.0">
|
||||
<persistence-unit name="keycloak-identity-store" transaction-type="RESOURCE_LOCAL">
|
||||
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
|
||||
|
||||
<provider>org.hibernate.ejb.HibernatePersistence</provider>
|
||||
|
||||
<class>org.picketlink.idm.jpa.model.sample.simple.AttributedTypeEntity</class>
|
||||
<class>org.picketlink.idm.jpa.model.sample.simple.AccountTypeEntity</class>
|
||||
<class>org.picketlink.idm.jpa.model.sample.simple.RoleTypeEntity</class>
|
||||
|
@ -22,12 +22,17 @@
|
|||
<class>org.keycloak.services.models.picketlink.mappings.ApplicationEntity</class>
|
||||
|
||||
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||
|
||||
|
||||
<properties>
|
||||
<property name="hibernate.connection.url" value="jdbc:h2:mem:test"/>
|
||||
<property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
|
||||
<property name="hibernate.connection.username" value="sa"/>
|
||||
<property name="hibernate.connection.password" value=""/>
|
||||
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
||||
<property name="hibernate.show_sql" value="false" />
|
||||
<property name="hibernate.format_sql" value="false" />
|
||||
<property name="hibernate.format_sql" value="true" />
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
|
||||
|
||||
</persistence>
|
|
@ -1,5 +0,0 @@
|
|||
<jboss-web>
|
||||
<valve>
|
||||
<class-name>org.keycloak.adapters.as7.OAuthManagedResourceValve</class-name>
|
||||
</valve>
|
||||
</jboss-web>
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
|
||||
<module-name>app</module-name>
|
||||
|
||||
<security-constraint>
|
||||
<web-resource-collection>
|
||||
<web-resource-name>Customers</web-resource-name>
|
||||
<url-pattern>/user.jsp</url-pattern>
|
||||
</web-resource-collection>
|
||||
<auth-constraint>
|
||||
<role-name>user</role-name>
|
||||
</auth-constraint>
|
||||
</security-constraint>
|
||||
|
||||
<login-config>
|
||||
<auth-method>BASIC</auth-method>
|
||||
<realm-name>commerce</realm-name>
|
||||
</login-config>
|
||||
|
||||
<security-role>
|
||||
<role-name>user</role-name>
|
||||
</security-role>
|
||||
</web-app>
|
|
@ -1,9 +0,0 @@
|
|||
<arquillian xmlns="http://jboss.org/schema/arquillian"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://jboss.org/schema/arquillian
|
||||
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
|
||||
<extension qualifier="webdriver">
|
||||
<property name="browser">${browser:phantomjs}</property>
|
||||
</extension>
|
||||
</arquillian>
|
|
@ -1,12 +0,0 @@
|
|||
<jboss-deployment-structure>
|
||||
<deployment>
|
||||
<!-- This allows you to define additional dependencies, it is the same as using the Dependencies: manifest attribute -->
|
||||
<dependencies>
|
||||
<module name="org.bouncycastle"/>
|
||||
<module name="org.jboss.resteasy.resteasy-jaxrs" services="import"/>
|
||||
<module name="org.jboss.resteasy.resteasy-crypto"/>
|
||||
<module name="org.jboss.resteasy.resteasy-jackson-provider" services="import"/>
|
||||
<module name="org.jboss.resteasy.jose-jwt" />
|
||||
</dependencies>
|
||||
</deployment>
|
||||
</jboss-deployment-structure>
|
|
@ -1,76 +0,0 @@
|
|||
{
|
||||
"realm": "demo",
|
||||
"enabled": true,
|
||||
"tokenLifespan": 300,
|
||||
"accessCodeLifespan": 10,
|
||||
"accessCodeLifespanUserAction": 600,
|
||||
"sslNotRequired": true,
|
||||
"cookieLoginAllowed": true,
|
||||
"registrationAllowed": true,
|
||||
"verifyEmail": 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,
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
{
|
||||
"realm": "demo",
|
||||
"enabled": true,
|
||||
"tokenLifespan": 300,
|
||||
"accessCodeLifespan": 10,
|
||||
"accessCodeLifespanUserAction": 600,
|
||||
"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", "totp" ],
|
||||
"requiredApplicationCredentials": [ "password" ],
|
||||
"requiredOAuthClientCredentials": [ "password" ],
|
||||
"defaultRoles": [ "user" ],
|
||||
"users" : [
|
||||
{
|
||||
"username" : "bburke@redhat.com",
|
||||
"enabled": true,
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"realm": "demo",
|
||||
"realm": "test",
|
||||
"enabled": true,
|
||||
"tokenLifespan": 300,
|
||||
"accessCodeLifespan": 10,
|
||||
|
@ -16,47 +16,9 @@
|
|||
"defaultRoles": [ "user" ],
|
||||
"users" : [
|
||||
{
|
||||
"username" : "bburke@redhat.com",
|
||||
"enabled": true,
|
||||
"email" : "bburke@redhat.com",
|
||||
"credentials" : [
|
||||
{ "type" : "password",
|
||||
"value" : "password" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"username" : "reset@pass.com",
|
||||
"enabled": true,
|
||||
"requiredActions" : [ "UPDATE_PASSWORD" ],
|
||||
"email" : "reset@pass.com",
|
||||
"credentials" : [
|
||||
{ "type" : "password",
|
||||
"value" : "temp-password" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"username" : "updateprof@pass.com",
|
||||
"enabled": true,
|
||||
"requiredActions" : [ "UPDATE_PROFILE" ],
|
||||
"email" : "reset@pass.com",
|
||||
"credentials" : [
|
||||
{ "type" : "password",
|
||||
"value" : "password" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"username" : "multiple@actions.com",
|
||||
"enabled": true,
|
||||
"requiredActions" : [ "UPDATE_PROFILE", "UPDATE_PASSWORD" ],
|
||||
"email" : "multiple@actions.com",
|
||||
"credentials" : [
|
||||
{ "type" : "password",
|
||||
"value" : "temp-password" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"username" : "third-party",
|
||||
"username" : "test-user@localhost",
|
||||
"enabled": true,
|
||||
"email" : "test-user@localhost",
|
||||
"credentials" : [
|
||||
{ "type" : "password",
|
||||
"value" : "password" }
|
||||
|
@ -75,37 +37,15 @@
|
|||
],
|
||||
"roleMappings": [
|
||||
{
|
||||
"username": "bburke@redhat.com",
|
||||
"roles": ["user"]
|
||||
},
|
||||
{
|
||||
"username": "reset@pass.com",
|
||||
"roles": ["user"]
|
||||
},
|
||||
{
|
||||
"username": "updateprof@pass.com",
|
||||
"roles": ["user"]
|
||||
},
|
||||
{
|
||||
"username": "multiple@actions.com",
|
||||
"roles": ["user"]
|
||||
},
|
||||
{
|
||||
"username": "third-party",
|
||||
"roles": ["KEYCLOAK_IDENTITY_REQUESTER"]
|
||||
}
|
||||
],
|
||||
"scopeMappings": [
|
||||
{
|
||||
"username": "third-party",
|
||||
"username": "test-user@localhost",
|
||||
"roles": ["user"]
|
||||
}
|
||||
],
|
||||
"applications": [
|
||||
{
|
||||
"name": "customer-portal",
|
||||
"name": "test-app",
|
||||
"enabled": true,
|
||||
"adminUrl": "http://localhost:8080/app/j_admin_request",
|
||||
"adminUrl": "http://localhost:8081/app/logout",
|
||||
"useRealmMappings": true,
|
||||
"credentials": [
|
||||
{
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<%@ page import="javax.ws.rs.core.*" language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
|
||||
<html>
|
||||
<head>
|
||||
<title>User</title>
|
||||
</head>
|
||||
<body>
|
||||
<%
|
||||
String user = request.getUserPrincipal() != null ? request.getUserPrincipal().getName() : "not logged in";
|
||||
String redirectUri = request.getRequestURL().toString();
|
||||
%>
|
||||
<a href="http://localhost:8080/auth-server/rest/realms/demo/tokens/logout?redirect_uri=<%=redirectUri%>" id="logout">logout</a>
|
||||
<span id="user"><%=user%></span>
|
||||
</body>
|
||||
</html>
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
|
||||
<module-name>properties</module-name>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>SystemPropertiesSetter</servlet-name>
|
||||
<servlet-class>org.keycloak.testsuite.SystemPropertiesSetter</servlet-class>
|
||||
<init-param>
|
||||
<param-name>keycloak.mail.smtp.from</param-name>
|
||||
<param-value>auto@keycloak.org</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>keycloak.mail.smtp.host</param-name>
|
||||
<param-value>localhost</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>keycloak.mail.smtp.port</param-name>
|
||||
<param-value>3025</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
</web-app>
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
|
||||
<module-name>auth-server</module-name>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>Resteasy</servlet-name>
|
||||
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher</servlet-class>
|
||||
<init-param>
|
||||
<param-name>javax.ws.rs.Application</param-name>
|
||||
<param-value>org.keycloak.testsuite.TestApplication</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>resteasy.servlet.mapping.prefix</param-name>
|
||||
<param-value>/rest</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
<async-supported>true</async-supported>
|
||||
</servlet>
|
||||
|
||||
<filter>
|
||||
<filter-name>Keycloak Session Management</filter-name>
|
||||
<filter-class>org.keycloak.services.filters.KeycloakSessionServletFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>Keycloak Session Management</filter-name>
|
||||
<url-pattern>/rest/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>Resteasy</servlet-name>
|
||||
<url-pattern>/rest/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!--
|
||||
<security-constraint>
|
||||
<web-resource-collection>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</web-resource-collection>
|
||||
<user-data-constraint>
|
||||
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
|
||||
</user-data-constraint>
|
||||
</security-constraint> -->
|
||||
|
||||
</web-app>
|
Loading…
Reference in a new issue