You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2016/01/14 16:42:38 UTC
[1/3] cxf-fediz git commit: More OIDC tests
Repository: cxf-fediz
Updated Branches:
refs/heads/master 6842bcfc2 -> a4a444400
More OIDC tests
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/5f5dfbf9
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/5f5dfbf9
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/5f5dfbf9
Branch: refs/heads/master
Commit: 5f5dfbf9ae7a6193c911a7b194e64ff3e91c1a44
Parents: 6842bcf
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Thu Jan 14 15:34:29 2016 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Thu Jan 14 15:34:29 2016 +0000
----------------------------------------------------------------------
.../webapp/WEB-INF/views/registeredClients.jsp | 2 +-
systests/oidc/pom.xml | 1 +
.../cxf/fediz/systests/oidc/OIDCTest.java | 74 ++++++++++++++++----
3 files changed, 63 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/5f5dfbf9/services/oidc/src/main/webapp/WEB-INF/views/registeredClients.jsp
----------------------------------------------------------------------
diff --git a/services/oidc/src/main/webapp/WEB-INF/views/registeredClients.jsp b/services/oidc/src/main/webapp/WEB-INF/views/registeredClients.jsp
index 6ddeca0..afd91ae 100644
--- a/services/oidc/src/main/webapp/WEB-INF/views/registeredClients.jsp
+++ b/services/oidc/src/main/webapp/WEB-INF/views/registeredClients.jsp
@@ -40,7 +40,7 @@
<div class="padded">
<h1>Registered Clients</h1>
<br/>
-<table border="1">
+<table border="1" id=registered_clients>
<tr><th>Name</th><th>ID</th><th>Creation Date</th><th>Redirect URI</th></tr>
<%
SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy", Locale.US);
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/5f5dfbf9/systests/oidc/pom.xml
----------------------------------------------------------------------
diff --git a/systests/oidc/pom.xml b/systests/oidc/pom.xml
index b96f16d..42bf107 100644
--- a/systests/oidc/pom.xml
+++ b/systests/oidc/pom.xml
@@ -234,6 +234,7 @@
<wt.headless>true</wt.headless>
<idp.https.port>${idp.https.port}</idp.https.port>
<rp.https.port>${rp.https.port}</rp.https.port>
+ <java.io.tmpdir>${basedir}/target</java.io.tmpdir>
</systemPropertyVariables>
<includes>
<include>**/systests/**</include>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/5f5dfbf9/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTest.java
----------------------------------------------------------------------
diff --git a/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTest.java b/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTest.java
index 41918df..2401a03 100644
--- a/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTest.java
+++ b/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTest.java
@@ -22,6 +22,11 @@ package org.apache.cxf.fediz.systests.oidc;
import java.io.File;
import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebRequest;
@@ -32,6 +37,9 @@ import com.gargoylesoftware.htmlunit.html.HtmlButton;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+import com.gargoylesoftware.htmlunit.html.HtmlTable;
+import com.gargoylesoftware.htmlunit.html.HtmlTableCell;
+import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
import com.gargoylesoftware.htmlunit.util.WebConnectionWrapper;
@@ -58,7 +66,7 @@ public class OIDCTest {
private static Tomcat rpServer;
@BeforeClass
- public static void init() {
+ public static void init() throws Exception {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info");
@@ -75,6 +83,8 @@ public class OIDCTest {
initIdp();
initOidc();
+
+ loginToClientsPage(rpHttpsPort, idpHttpsPort);
}
private static void initIdp() {
@@ -193,16 +203,16 @@ public class OIDCTest {
}
// Login to the OIDC Clients page + create a new client
- @org.junit.Test
- public void testLoginToClientsPage() throws Exception {
- String url = "https://localhost:" + getRpHttpsPort() + "/fediz-oidc/clients";
+ private static void loginToClientsPage(String rpPort, String idpPort) throws Exception {
+ String url = "https://localhost:" + rpPort + "/fediz-oidc/clients";
String user = "alice";
String password = "ecila";
// Login to the client page successfully
- WebClient webClient = setupWebClient(user, password, getIdpHttpsPort());
- final String bodyTextContent = login(url, webClient);
- Assert.assertTrue(bodyTextContent.contains("Registered API Clients"));
+ WebClient webClient = setupWebClient(user, password, idpPort);
+ HtmlPage loginPage = login(url, webClient);
+ final String bodyTextContent = loginPage.getBody().getTextContent();
+ Assert.assertTrue(bodyTextContent.contains("Registered Clients"));
// Now try to register a new client
HtmlPage registerPage = webClient.getPage(url + "/register");
@@ -219,13 +229,53 @@ public class OIDCTest {
final HtmlPage rpPage = button.click();
String registeredClientPage = rpPage.getBody().getTextContent();
- Assert.assertTrue(registeredClientPage.contains("Registered API Clients"));
+ Assert.assertTrue(registeredClientPage.contains("Registered Clients"));
Assert.assertTrue(registeredClientPage.contains("new-client"));
Assert.assertTrue(registeredClientPage.contains("http://127.0.0.1"));
webClient.close();
}
+ // Test that we managed to create a new Client ok
+ @org.junit.Test
+ public void testClientCreated() throws Exception {
+ String url = "https://localhost:" + getRpHttpsPort() + "/fediz-oidc/clients";
+ String user = "alice";
+ String password = "ecila";
+
+ // Login to the client page successfully
+ WebClient webClient = setupWebClient(user, password, getIdpHttpsPort());
+ HtmlPage loginPage = login(url, webClient);
+ final String bodyTextContent = loginPage.getBody().getTextContent();
+ Assert.assertTrue(bodyTextContent.contains("Registered Clients"));
+
+ // Get the new client identifier
+ HtmlTable table = loginPage.getHtmlElementById("registered_clients");
+ String clientId = table.getCellAt(1, 1).asText().trim();
+ Assert.assertNotNull(clientId);
+
+ // Check the Date
+ String date = table.getCellAt(1, 2).asText().trim();
+ SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy", Locale.US);
+ dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
+ Assert.assertEquals(dateFormat.format(new Date()), date);
+
+ // Check the redirect URI
+ String redirectURI = table.getCellAt(1, 3).asText().trim();
+ Assert.assertEquals("http://127.0.0.1", redirectURI);
+
+ Assert.assertEquals(table.getRows().size(), 2);
+ }
+
+ /*
+ @org.junit.Test
+ public void testTemp() throws Exception {
+ String url = "https://localhost:" + getRpHttpsPort() + "/fediz-oidc/clients";
+ System.out.println("URL: " + url);
+ Thread.sleep(60 * 1000);
+ }
+ */
+
@org.junit.Test
@org.junit.Ignore
public void testOIDCLogin() throws Exception {
@@ -259,12 +309,12 @@ public class OIDCTest {
return webClient;
}
- private static String login(String url, WebClient webClient) throws IOException {
+ private static HtmlPage login(String url, WebClient webClient) throws IOException {
webClient.getOptions().setJavaScriptEnabled(false);
final HtmlPage idpPage = webClient.getPage(url);
webClient.getOptions().setJavaScriptEnabled(true);
Assert.assertEquals("IDP SignIn Response Form", idpPage.getTitleText());
-
+
// Test the SAML Version here
DomNodeList<DomElement> results = idpPage.getElementsByTagName("input");
@@ -281,9 +331,7 @@ public class OIDCTest {
final HtmlForm form = idpPage.getFormByName("signinresponseform");
final HtmlSubmitInput button = form.getInputByName("_eventId_submit");
- final HtmlPage rpPage = button.click();
-
- return rpPage.getBody().getTextContent();
+ return button.click();
}
private static String loginAndGetAuthorizationCode(
[3/3] cxf-fediz git commit: Updating Apache DS
Posted by co...@apache.org.
Updating Apache DS
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/a4a44440
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/a4a44440
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/a4a44440
Branch: refs/heads/master
Commit: a4a444400eb5f241986a827c1fb9eaf64adc85b9
Parents: 6608107
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Thu Jan 14 15:41:55 2016 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Thu Jan 14 15:41:55 2016 +0000
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/a4a44440/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5c45967..bbba1aa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,7 @@
</prerequisites>
<properties>
- <apacheds.version>2.0.0-M20</apacheds.version>
+ <apacheds.version>2.0.0-M21</apacheds.version>
<commons.lang.version>3.4</commons.lang.version>
<commons.logging.version>1.2</commons.logging.version>
<cxf.version>3.1.5-SNAPSHOT</cxf.version>
[2/3] cxf-fediz git commit: Updating Kerberos systests
Posted by co...@apache.org.
Updating Kerberos systests
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/6608107a
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/6608107a
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/6608107a
Branch: refs/heads/master
Commit: 6608107a3544332313da3ecfcd138f2f47f796b8
Parents: 5f5dfbf
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Thu Jan 14 15:41:47 2016 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Thu Jan 14 15:41:47 2016 +0000
----------------------------------------------------------------------
.../apache/cxf/fediz/integrationtests/KerberosTest.java | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/6608107a/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java b/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
index 57c9876..564731a 100644
--- a/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
+++ b/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
@@ -41,7 +41,6 @@ import org.apache.commons.io.IOUtils;
import org.apache.cxf.fediz.core.ClaimTypes;
import org.apache.cxf.fediz.tomcat7.FederationAuthenticator;
import org.apache.directory.server.annotations.CreateKdcServer;
-import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifFiles;
import org.apache.directory.server.core.annotations.CreateDS;
@@ -93,16 +92,9 @@ import org.junit.runner.RunWith;
}
)
-@CreateLdapServer(
- transports = {
- @CreateTransport(protocol = "LDAP")
- }
-)
-
@CreateKdcServer(
transports = {
- // @CreateTransport(protocol = "TCP", address = "127.0.0.1", port=1024)
- @CreateTransport(protocol = "UDP", address = "127.0.0.1")
+ @CreateTransport(protocol = "KRB", address = "127.0.0.1")
},
primaryRealm = "service.ws.apache.org",
kdcPrincipal = "krbtgt/service.ws.apache.org@service.ws.apache.org"