[java-idp-jetty-base] 07/09: IDP-2297 Explore extending the Plugin and Module Infrastructure to allow Jetty installation

Rod Widdowson rdw at steadingsoftware.com
Sat Aug 10 15:04:35 UTC 2024


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

rdw pushed a commit to branch dev/IDP-2297
in repository java-idp-jetty-base.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-jetty-base.git;a=commit;h=f330d4f822f0166f057e3f5d84e85393437edd1a

commit f330d4f822f0166f057e3f5d84e85393437edd1a
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Aug 9 13:57:46 2024 +0100

    IDP-2297 Explore extending the Plugin and Module Infrastructure to allow Jetty installation
    
    https://shibboleth.atlassian.net/browse/IDP-2297
    
    Adjust the plugin:
    
      + Move the static folder from jetty-base to idp.home (cos that's where windows puts it)
    
      + Separate the windows idp.ini/idp-system.ini from the non windows idp.ini/custom.ini
    
      + Move the credentials directory from jetty-base to idp.home
    
      + Populate an suitableidp-userfacing.p12 into idp.home
---
 .../idp/plugin/jettybase/JettyBaseModule.java      |   6 +--
 .../idp/plugin/jettybase/module.properties         |  41 +++++++++++++++++----
 .../module/credentials/idp-userfacing.p12          | Bin 0 -> 3448 bytes
 .../plugin/jettybase/module/start.d/idp-system.ini |  17 +++++++++
 .../idp/plugin/jettybase/module/start.d/idp.ini    |   4 +-
 .../jettybase/module/start.d/idp.ini-windows       |  21 +++++++++++
 .../idp/plugin/jettybase/module/webapps/static.xml |   4 +-
 7 files changed, 77 insertions(+), 16 deletions(-)

diff --git a/jetty-base-impl/src/main/java/net/shibboleth/idp/plugin/jettybase/JettyBaseModule.java b/jetty-base-impl/src/main/java/net/shibboleth/idp/plugin/jettybase/JettyBaseModule.java
index e15dd91..5fee719 100644
--- a/jetty-base-impl/src/main/java/net/shibboleth/idp/plugin/jettybase/JettyBaseModule.java
+++ b/jetty-base-impl/src/main/java/net/shibboleth/idp/plugin/jettybase/JettyBaseModule.java
@@ -45,12 +45,12 @@ public class JettyBaseModule extends PluginIdPModule {
     @Nonnull
     public Map<ModuleResource, ResourceResult> enable(@Nonnull ModuleContext moduleContext) throws ModuleException {
         final Map<ModuleResource, ResourceResult> result = super.enable(moduleContext);
-        final Path jettyBase = Path.of(moduleContext.getInstallLocation()).resolve("jetty-base");
+        final Path idpHome = Path.of(moduleContext.getInstallLocation());
+        final Path jettyBase = idpHome.resolve("jetty-base");
         log.debug("Creating directories (if needed): 'credentials', 'logs', 'static', 'tmp' below {}", jettyBase);
         try {
-            Files.createDirectory(jettyBase.resolve("credentials"));
             Files.createDirectory(jettyBase.resolve("logs"));
-            Files.createDirectory(jettyBase.resolve("static"));
+            Files.createDirectory(idpHome.resolve("static"));
             Files.createDirectory(jettyBase.resolve("tmp"));
         } catch (final IOException e) {
             log.error("Create Directory failed", e);
diff --git a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module.properties b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module.properties
index 442becd..db9472f 100644
--- a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module.properties
+++ b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module.properties
@@ -18,14 +18,39 @@ jetty.base.module.2.dest = jetty-base/modules/idp.mod
 jetty.base.module.3.src = /net/shibboleth/idp/plugin/jettybase/module/resources/logback.xml
 jetty.base.module.3.dest = jetty-base/resources/logback.xml
 
-jetty.base.module.4.src = /net/shibboleth/idp/plugin/jettybase/module/start.d/custom.ini
-jetty.base.module.4.dest = jetty-base/start.d/custom.ini
+jetty.base.module.4.src = /net/shibboleth/idp/plugin/jettybase/module/webapps/idp.xml
+jetty.base.module.4.dest = jetty-base/webapps/idp.xml
 
-jetty.base.module.5.src = /net/shibboleth/idp/plugin/jettybase/module/start.d/idp.ini
-jetty.base.module.5.dest = jetty-base/start.d/idp.ini
+jetty.base.module.5.src = /net/shibboleth/idp/plugin/jettybase/module/webapps/static.xml
+jetty.base.module.5.dest = jetty-base/webapps/static.xml
 
-jetty.base.module.6.src = /net/shibboleth/idp/plugin/jettybase/module/webapps/idp.xml
-jetty.base.module.6.dest = jetty-base/webapps/idp.xml
+jetty.base.module.6.src = /net/shibboleth/idp/plugin/jettybase/module/credentials/idp-userfacing.p12
+jetty.base.module.6.dest = credentials/idp-userfacing.p12
+
+
+# For legacy reasons we separate Windows and non windows start.d
+
+jetty.base.module.7.src = /net/shibboleth/idp/plugin/jettybase/module/start.d/custom.ini
+jetty.base.module.7.dest = jetty-base/start.d/custom.ini
+jetty.base.module.7.nonwindows = true
+jetty.base.module.7.windows = false
+jetty.base.module.7.replace = false
+
+jetty.base.module.8.src = /net/shibboleth/idp/plugin/jettybase/module/start.d/idp.ini
+jetty.base.module.8.dest = jetty-base/start.d/idp.ini
+jetty.base.module.8.nonwindows = true
+jetty.base.module.8.windows = false
+jetty.base.module.8.replace = false
+
+jetty.base.module.9.src = /net/shibboleth/idp/plugin/jettybase/module/start.d/idp-system.ini
+jetty.base.module.9.dest = jetty-base/start.d/start.d/idp-system.ini
+jetty.base.module.9.nonwindows = false
+jetty.base.module.9.windows = true
+jetty.base.module.9.replace = true
+
+jetty.base.module.10.src = /net/shibboleth/idp/plugin/jettybase/module/start.d/idp.ini-windows
+jetty.base.module.10.dest = jetty-base/start.d/idp.ini
+jetty.base.module.10.nonwindows = false
+jetty.base.module.10.windows = true
+jetty.base.module.10.replace = false
 
-jetty.base.module.7.src = /net/shibboleth/idp/plugin/jettybase/module/webapps/static.xml
-jetty.base.module.7.dest = jetty-base/webapps/static.xml
diff --git a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/credentials/idp-userfacing.p12 b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/credentials/idp-userfacing.p12
new file mode 100644
index 0000000..7acc8f0
Binary files /dev/null and b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/credentials/idp-userfacing.p12 differ
diff --git a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/start.d/idp-system.ini b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/start.d/idp-system.ini
new file mode 100644
index 0000000..cae682b
--- /dev/null
+++ b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/start.d/idp-system.ini
@@ -0,0 +1,17 @@
+#
+# Do not edit anything in this file
+#
+--module=logging-logback
+--module=idp
+
+## Deny SSL renegotiation
+jetty.sslContext.renegotiationAllowed=false
+
+jetty.ssl.port=443
+jetty.http.port=80
+jetty.http.host=localhost
+
+## Route request logging through standard logging API
+etc/jetty-requestlog.xml
+
+jetty.ssl.sniHostCheck=false
diff --git a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/start.d/idp.ini b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/start.d/idp.ini
index 92b2b87..c8dba1f 100644
--- a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/start.d/idp.ini
+++ b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/start.d/idp.ini
@@ -6,9 +6,9 @@
 --module=idp
 
 ## Keystore file path (relative to $jetty.base)
-jetty.sslContext.keyStorePath=credentials/idp-userfacing.p12
+jetty.sslContext.keyStorePath=../credentials/idp-userfacing.p12
 ## Truststore file path (relative to $jetty.base)
-jetty.sslContext.trustStorePath=credentials/idp-userfacing.p12
+jetty.sslContext.trustStorePath=../credentials/idp-userfacing.p12
 
 ## Keystore type
 jetty.sslContext.keyStoreType=PKCS12
diff --git a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/start.d/idp.ini-windows b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/start.d/idp.ini-windows
new file mode 100644
index 0000000..3c2e7a4
--- /dev/null
+++ b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/start.d/idp.ini-windows
@@ -0,0 +1,21 @@
+#
+# Note for Windows users:
+#
+# These are the only three properties which are guaranteed to work between
+# upgrades.  You may find more elsewhere and add them here and they may
+# work. For this release.
+#
+# To repeat, only properties listed below are guarantee to work between
+# upgrades.
+#
+
+#
+# KeyStore Management.
+#
+jetty.sslContext.keyStorePath=../credentials/idp-userfacing.p12
+jetty.sslContext.keyStorePassword=changeit
+
+#
+# Keystore type: you ahould not need to change this
+#
+jetty.sslContext.keyStoreType=PKCS12
diff --git a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/webapps/static.xml b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/webapps/static.xml
index f4f90fc..2fa6c00 100644
--- a/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/webapps/static.xml
+++ b/jetty-base-impl/src/main/resources/net/shibboleth/idp/plugin/jettybase/module/webapps/static.xml
@@ -7,9 +7,7 @@
   <Set name="contextPath">/</Set>
   <Set name="handler">
     <New class="org.eclipse.jetty.server.handler.ResourceHandler">
-      <Set name="baseResourceAsString">
-        <SystemProperty name="jetty.base"/>/<Property name="jetty.static.data.path" default="static"/>
-      </Set>
+      <Set name="baseResourceAsString"><SystemProperty name="idp.home"/>/static</Set>
       <Set name="dirAllowed">false</Set>
     </New>
   </Set>

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


More information about the commits mailing list