[java-idp-integration-tests] 03/14: Support testing using non-secure port (by default 8080)

Tom Zeller tzeller at dragonacea.biz
Thu Jun 17 13:55:47 UTC 2021


This is an automated email from the git hooks/post-receive script.

tzeller pushed a commit to branch main
in repository java-idp-integration-tests.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=49050a23d9babee172e7f939338d58782ca49c47

commit 49050a23d9babee172e7f939338d58782ca49c47
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Wed Jun 16 21:31:40 2021 -0500

    Support testing using non-secure port (by default 8080)
---
 .../shibboleth/idp/test/BaseIntegrationTest.java   | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
index 3414268..d292a5a 100644
--- a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
@@ -796,6 +796,37 @@ public abstract class BaseIntegrationTest
         replaceIdPHomeFile(Paths.get("metadata", "example-metadata.xml"), "https://localhost:8443", secureBaseURL);
     }
 
+    /**
+     * If system property 'no-secure' is 'true', use non-secure port (default 8080).
+     * 
+     * Otherwise, use secure port (default 8443).
+     * 
+     * @throws IOException if unable to set up non-secure port
+     */
+    @BeforeClass(dependsOnMethods = {"setUpEndpoints"})
+    public void setUpNonSecurePort() throws IOException {
+        if (!Boolean.getBoolean("no-secure")) {
+            return;
+        }
+
+        // Add http module to Jetty
+        final Path pathToIdPMod = Paths.get("jetty-base", "modules", "idp.mod");
+        replaceIdPHomeFile(pathToIdPMod, "https", "http\nhttps");
+
+        // Set HTTP port used by Jetty
+        final Path pathToIdpIni = Paths.get("jetty-base", "start.d", "idp.ini");
+        replaceIdPHomeFile(pathToIdpIni, "\\z", System.lineSeparator() + "jetty.http.port=" + port);
+
+        // Set secure container session cookie to false
+        final Path pathToIdPWebXML = Paths.get("webapp", "WEB-INF", "web.xml");
+        replaceIdPHomeFile(pathToIdPWebXML, "<secure>true</secure>", "<secure>false</secure>");
+
+        // Set secure cookies to false
+        replaceIdPProperty("idp.cookie.secure", "false");
+
+        useSecureBaseURL = false;
+    }
+
     /**
      * Set up debug logging for the IdP.
      * 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list