[java-idp-integration-tests] 12/14: Automatically use non-secure port when using Safari on macOS

Tom Zeller tzeller at dragonacea.biz
Thu Jun 17 13:55:56 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=4d2bb061a0e30e3978f5794e771ba7465c6e6477

commit 4d2bb061a0e30e3978f5794e771ba7465c6e6477
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Thu Jun 17 08:39:55 2021 -0500

    Automatically use non-secure port when using Safari on macOS
---
 .../shibboleth/idp/test/BaseIntegrationTest.java   | 38 ++++++++++++++++++----
 1 file changed, 31 insertions(+), 7 deletions(-)

diff --git a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
index 7bba93b..dbe9aa9 100644
--- a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
@@ -798,18 +798,16 @@ public abstract class BaseIntegrationTest
     }
 
     /**
-     * If system property 'no-secure' is 'true', use non-secure port (default 8080).
+     * Use non-secure port (default 8080) rather than secure port (default 8443).
      * 
-     * Otherwise, use secure port (default 8443).
+     * Enables Jetty http module.
+     * Sets jetty.http.port to non-secure port.
+     * Disable session cookie security.
+     * Sets idp.cookie.secure to false.
      * 
      * @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");
@@ -828,6 +826,20 @@ public abstract class BaseIntegrationTest
         useSecureBaseURL = false;
     }
 
+    /**
+     * If system property 'no-secure' is 'true', use non-secure port.
+     * 
+     * @see #setUpNonSecurePort()
+     * 
+     * @throws IOException if unable to set up non-secure port
+     */
+    @BeforeClass(dependsOnMethods = {"setUpEndpoints"})
+    public void setUpNonSecurePortFromSystemProperties() throws IOException {
+        if (Boolean.getBoolean("no-secure")) {
+            setUpNonSecurePort();
+        }
+    }
+
     /**
      * Set up debug logging for the IdP.
      * 
@@ -1500,6 +1512,12 @@ public abstract class BaseIntegrationTest
      * 
      * The desired capabilities will be overridden by the {@link #overrideCapabilities} if non-null.
      * 
+     * Disables JSON view when using Firefox.
+     * 
+     * Accepts insecure certs when using browsers other than Safari.
+     * 
+     * Use non-secure port when using Safari.
+     * 
      * @param browserData the browser data
      */
     public void setUpDesiredCapabilities(@Nullable final BrowserData browserData) {
@@ -1540,6 +1558,12 @@ public abstract class BaseIntegrationTest
 
         if (browserData != null && browserData.getBrowser().equalsIgnoreCase("safari")) {
             log.warn("Safari does not support accepting insecure certs");
+            try {
+                setUpNonSecurePort();
+            } catch (IOException e) {
+                log.error("Unable to set up non-secure port {}", e);
+                throw new RuntimeException(e);
+            }
         } else {
             desiredCapabilities.setAcceptInsecureCerts(true);
         }

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


More information about the commits mailing list