diff --git a/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/pom.xml b/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/pom.xml
index 54213b00347b..4f07bfabc191 100644
--- a/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/pom.xml
+++ b/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/pom.xml
@@ -13,32 +13,30 @@
${project.groupId}.jaas
-
+
${basedir}/src/main/config/modules/demo.d
-
- ${basedir}/src/main/config/modules/demo.d/demo-login.conf
+ ${basedir}/src/main/etc/ee10-demo-login.conf
- /test-jaas
+ /ee10-test-jaas
Test JAAS Realm
- xyz
+ ee10-xyz
-
+ -->
diff --git a/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/config/modules/demo.d/ee10-demo-jaas.xml b/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/config/modules/demo.d/ee10-demo-jaas.xml
index b115ebad4f69..3466d90dfdf6 100644
--- a/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/config/modules/demo.d/ee10-demo-jaas.xml
+++ b/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/config/modules/demo.d/ee10-demo-jaas.xml
@@ -16,7 +16,7 @@
Demo JAAS Realm
- xyz
+ ee10-xyz
diff --git a/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/config/modules/ee10-demo-jaas.mod b/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/config/modules/ee10-demo-jaas.mod
index f5ad6958effe..6ab2602110fd 100644
--- a/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/config/modules/ee10-demo-jaas.mod
+++ b/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/config/modules/ee10-demo-jaas.mod
@@ -11,6 +11,7 @@ demo
webapp
[depends]
+demo-jaas
ee10-deploy
ee10-jaas
jdbc
@@ -20,7 +21,6 @@ ext
[files]
basehome:modules/demo.d/ee10-demo-jaas.xml|webapps/ee10-demo-jaas.xml
-basehome:modules/demo.d/ee10-demo-login.conf|etc/ee10-demo-login.conf
basehome:modules/demo.d/ee10-demo-login.properties|etc/ee10-demo-login.properties
maven://org.eclipse.jetty.ee10.demos/jetty-ee10-demo-jaas-webapp/${jetty.version}/war|webapps/ee10-demo-jaas.war
diff --git a/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/config/modules/demo.d/ee10-demo-login.conf b/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/etc/ee10-demo-login.conf
similarity index 92%
rename from jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/config/modules/demo.d/ee10-demo-login.conf
rename to jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/etc/ee10-demo-login.conf
index 99b34a4dc995..fdbe26a49f6c 100644
--- a/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/config/modules/demo.d/ee10-demo-login.conf
+++ b/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/etc/ee10-demo-login.conf
@@ -1,4 +1,4 @@
-xyz {
+ee10-xyz {
org.eclipse.jetty.ee10.jaas.spi.PropertyFileLoginModule required
debug="true"
file="${jetty.base}/etc/ee10-demo-login.properties";
diff --git a/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/webapp/index.html b/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/webapp/index.html
index 8d3c88c9c452..4cd6bb6e818e 100644
--- a/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/webapp/index.html
+++ b/jetty-ee10/jetty-ee10-demos/jetty-ee10-demo-jaas-webapp/src/main/webapp/index.html
@@ -26,13 +26,6 @@
JAAS Demo
It uses a simple login module that stores its configuration in a properties file.
- Preparation
- To use JAAS in a base jetty instance enable the jaas
module:
-
- $ cd $JETTY_BASE
- $ java -jar $JETTY_HOME/start.jar --add-module=jaas
-
-
Using the Demo
Click on the link below to test JAAS authentication and role-based web security constraint authorization. Use
diff --git a/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/pom.xml b/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/pom.xml
index 5aedc39fdfa1..903eff752ed3 100644
--- a/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/pom.xml
+++ b/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/pom.xml
@@ -14,32 +14,30 @@
${project.groupId}.jaas
-
+
${basedir}/src/main/config/modules/demo.d
-
- ${basedir}/src/main/config/modules/demo.d/ee8-demo-login.conf
+ ${basedir}/src/main/etc/ee8-demo-login.conf
/test-jaas
-
+
Test JAAS Realm
- xyz
+ ee8-xyz
-
+
diff --git a/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/config/modules/demo.d/ee8-demo-jaas.xml b/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/config/modules/demo.d/ee8-demo-jaas.xml
index d843ae3daf4f..9879b09db6bd 100644
--- a/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/config/modules/demo.d/ee8-demo-jaas.xml
+++ b/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/config/modules/demo.d/ee8-demo-jaas.xml
@@ -16,7 +16,7 @@
Demo JAAS Realm
- xyz
+ ee8-xyz
diff --git a/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/config/modules/ee8-demo-jaas.mod b/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/config/modules/ee8-demo-jaas.mod
index 3049fdb9056d..7ff08b15ec42 100644
--- a/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/config/modules/ee8-demo-jaas.mod
+++ b/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/config/modules/ee8-demo-jaas.mod
@@ -11,6 +11,7 @@ demo
webapp
[depends]
+demo-jaas
ee8-deploy
ee8-jaas
jdbc
@@ -21,7 +22,6 @@ ext
[files]
basehome:modules/demo.d/ee8-demo-jaas.xml|webapps/ee8-demo-jaas.xml
basehome:modules/demo.d/ee8-demo-jaas.properties|webapps/ee8-demo-jaas.properties
-basehome:modules/demo.d/ee8-demo-login.conf|etc/ee8-demo-login.conf
basehome:modules/demo.d/ee8-demo-login.properties|etc/ee8-demo-login.properties
maven://org.eclipse.jetty.ee8.demos/jetty-ee8-demo-jaas-webapp/${jetty.version}/war|webapps/ee8-demo-jaas.war
diff --git a/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/config/modules/demo.d/ee8-demo-login.conf b/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/etc/ee8-demo-login.conf
similarity index 92%
rename from jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/config/modules/demo.d/ee8-demo-login.conf
rename to jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/etc/ee8-demo-login.conf
index 0dffbafaec53..39bd21216514 100644
--- a/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/config/modules/demo.d/ee8-demo-login.conf
+++ b/jetty-ee8/jetty-ee8-demos/jetty-ee8-demo-jaas-webapp/src/main/etc/ee8-demo-login.conf
@@ -1,4 +1,4 @@
-xyz {
+ee8-xyz {
org.eclipse.jetty.ee8.jaas.spi.PropertyFileLoginModule required
debug="true"
file="${jetty.base}/etc/ee8-demo-login.properties";
diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/pom.xml b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/pom.xml
index 8df973f45545..24801a33f1d9 100644
--- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/pom.xml
+++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/pom.xml
@@ -13,32 +13,30 @@
${project.groupId}.jaas
-
+
${basedir}/src/main/config/modules/demo.d
-
- ${basedir}/src/main/config/modules/demo.d/ee9-demo-login.conf
+ ${basedir}/src/main/etc/ee9-demo-login.conf
/test-jaas
-
+
Test JAAS Realm
- xyz
+ ee9-xyz
-
+
diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/demo.d/ee9-demo-jaas.xml b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/demo.d/ee9-demo-jaas.xml
index 738cd8c7ea1e..5f76f45841e3 100644
--- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/demo.d/ee9-demo-jaas.xml
+++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/demo.d/ee9-demo-jaas.xml
@@ -16,7 +16,7 @@
Demo JAAS Realm
- xyz
+ ee9-xyz
diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/ee9-demo-jaas.mod b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/ee9-demo-jaas.mod
index 0e1822561413..9492605a4a6f 100644
--- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/ee9-demo-jaas.mod
+++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/ee9-demo-jaas.mod
@@ -11,6 +11,7 @@ demo
webapp
[depends]
+demo-jaas
ee9-deploy
ee9-jaas
jdbc
@@ -21,7 +22,6 @@ ext
[files]
basehome:modules/demo.d/ee9-demo-jaas.xml|webapps/ee9-demo-jaas.xml
basehome:modules/demo.d/ee9-demo-jaas.properties|webapps/ee9-demo-jaas.properties
-basehome:modules/demo.d/ee9-demo-login.conf|etc/ee9-demo-login.conf
basehome:modules/demo.d/ee9-demo-login.properties|etc/ee9-demo-login.properties
maven://org.eclipse.jetty.ee9.demos/jetty-ee9-demo-jaas-webapp/${jetty.version}/war|webapps/ee9-demo-jaas.war
diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/demo.d/ee9-demo-login.conf b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/etc/ee9-demo-login.conf
similarity index 92%
rename from jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/demo.d/ee9-demo-login.conf
rename to jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/etc/ee9-demo-login.conf
index 259a63c417d0..99fd28824190 100644
--- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/demo.d/ee9-demo-login.conf
+++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/etc/ee9-demo-login.conf
@@ -1,4 +1,4 @@
-xyz {
+ee9-xyz {
org.eclipse.jetty.ee9.jaas.spi.PropertyFileLoginModule required
debug="true"
file="${jetty.base}/etc/ee9-demo-login.properties";
diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/webapp/index.html b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/webapp/index.html
index 8d3c88c9c452..8c0110020cfc 100644
--- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/webapp/index.html
+++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/webapp/index.html
@@ -25,13 +25,6 @@
JAAS Demo
It uses a simple login module that stores its configuration in a properties file.
-
- Preparation
- To use JAAS in a base jetty instance enable the jaas
module:
-
- $ cd $JETTY_BASE
- $ java -jar $JETTY_HOME/start.jar --add-module=jaas
-
Using the Demo
diff --git a/jetty-home/src/main/resources/modules/demo-jaas.mod b/jetty-home/src/main/resources/modules/demo-jaas.mod
new file mode 100644
index 000000000000..6812ba7c01dc
--- /dev/null
+++ b/jetty-home/src/main/resources/modules/demo-jaas.mod
@@ -0,0 +1,13 @@
+# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
+
+[description]
+Setup for jaas demos.
+
+[environment]
+core
+
+[tags]
+demo
+
+[files]
+basehome:modules/demo.d/demo-login.conf|etc/demo-login.conf
diff --git a/jetty-home/src/main/resources/modules/demo.d/demo-login.conf b/jetty-home/src/main/resources/modules/demo.d/demo-login.conf
new file mode 100644
index 000000000000..b31ec9a1db87
--- /dev/null
+++ b/jetty-home/src/main/resources/modules/demo.d/demo-login.conf
@@ -0,0 +1,17 @@
+ee10-xyz {
+org.eclipse.jetty.ee10.jaas.spi.PropertyFileLoginModule required
+debug="true"
+file="${jetty.base}/etc/ee10-demo-login.properties";
+};
+
+ee9-xyz {
+org.eclipse.jetty.ee9.jaas.spi.PropertyFileLoginModule required
+debug="true"
+file="${jetty.base}/etc/ee9-demo-login.properties";
+};
+
+ee8-xyz {
+org.eclipse.jetty.ee8.jaas.spi.PropertyFileLoginModule required
+debug="true"
+file="${jetty.base}/etc/ee8-demo-login.properties";
+};
diff --git a/tests/test-distribution/test-distribution-common/src/test/java/org/eclipse/jetty/tests/distribution/DemoModulesTests.java b/tests/test-distribution/test-distribution-common/src/test/java/org/eclipse/jetty/tests/distribution/DemoModulesTests.java
index 92e2b498e422..cf40e06cf0cf 100644
--- a/tests/test-distribution/test-distribution-common/src/test/java/org/eclipse/jetty/tests/distribution/DemoModulesTests.java
+++ b/tests/test-distribution/test-distribution-common/src/test/java/org/eclipse/jetty/tests/distribution/DemoModulesTests.java
@@ -139,6 +139,56 @@ public void testJspDump(String env) throws Exception
}
}
}
+
+ @ParameterizedTest
+ @MethodSource("provideEnvironmentsToTest")
+ public void testJaasDemo(String env) throws Exception
+ {
+ Path jettyBase = newTestJettyBaseDirectory();
+ String jettyVersion = System.getProperty("jettyVersion");
+ JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
+ .jettyVersion(jettyVersion)
+ .jettyBase(jettyBase)
+ .mavenLocalRepository(System.getProperty("mavenRepoPath"))
+ .build();
+
+ int httpPort = distribution.freePort();
+ int httpsPort = distribution.freePort();
+ assertThat("httpPort != httpsPort", httpPort, is(not(httpsPort)));
+
+ String[] argsConfig = {
+ "--add-modules=http," + toEnvironment("demos", env)
+ };
+
+ String baseURI = "http://localhost:%d/%s-test-jaas".formatted(httpPort, env);
+
+ try (JettyHomeTester.Run runConfig = distribution.start(argsConfig))
+ {
+ assertTrue(runConfig.awaitFor(START_TIMEOUT, TimeUnit.SECONDS));
+ assertEquals(0, runConfig.getExitValue());
+
+ String[] argsStart =
+ {
+ "jetty.http.port=" + httpPort,
+ "jetty.httpConfig.port=" + httpsPort,
+ "jetty.ssl.port=" + httpsPort
+ };
+
+ try (JettyHomeTester.Run runStart = distribution.start(argsStart))
+ {
+ assertTrue(runStart.awaitConsoleLogsFor("Started oejs.Server@", START_TIMEOUT, TimeUnit.SECONDS));
+
+ startHttpClient();
+ ContentResponse response = client.GET(baseURI + "/auth.html");
+ Fields fields = new Fields();
+ fields.put("j_username", "me");
+ fields.put("j_password", "me");
+ response = client.FORM(baseURI + "/j_security_check", fields);
+ assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));;
+ assertThat(response.getContentAsString(), containsString("SUCCESS!"));
+ }
+ }
+ }
@ParameterizedTest
@MethodSource("provideEnvironmentsToTest")