From b89de0346d6f34e50c148af6c04b854b92b533c7 Mon Sep 17 00:00:00 2001
From: Greg Wilkins
Date: Mon, 6 May 2013 16:16:08 +1000
Subject: [PATCH] updated jndi, jaas and annotation tests to webapps.demo
---
jetty-distribution/pom.xml | 95 ++++++++++++++
.../src/main/resources/etc/jetty-demo.xml | 124 ++++++++++++++++++
.../src/main/resources/start.d/900-demo.ini | 53 ++++++++
.../src/main/resources/start.ini | 47 ++++---
.../resources/webapps.demo/ROOT/index.html | 7 +-
jetty-jaas/src/main/config/etc/jetty-jaas.xml | 2 +-
.../src/main/config/etc/jetty-rewrite.xml | 98 +-------------
tests/test-webapps/test-jaas-webapp/pom.xml | 2 +-
.../src/main/assembly/config.xml | 2 +-
.../test-jaas.d}/login.conf | 2 +-
.../test-jaas.d}/login.properties | 0
.../main/config/webapps.demo/test-jaas.xml | 2 +-
.../src/main/webapp/auth.html | 4 +-
.../src/main/webapp/index.html | 21 +--
.../src/main/config/etc/jetty-demo.xml | 21 ---
.../src/main/config/start.d/900-demo.ini | 26 ----
.../src/main/webapp/index.html | 52 +++-----
.../src/main/assembly/config.xml | 8 +-
.../main/templates/jetty-test-jndi-header.xml | 2 +-
.../main/templates/plugin-context-header.xml | 13 +-
.../src/main/webapp/index.html | 22 ++--
.../src/main/assembly/config.xml | 10 +-
.../templates/annotations-context-header.xml | 10 +-
.../main/templates/plugin-context-header.xml | 11 +-
.../src/main/webapp/index.html | 38 ++----
25 files changed, 387 insertions(+), 285 deletions(-)
create mode 100644 jetty-distribution/src/main/resources/etc/jetty-demo.xml
create mode 100644 jetty-distribution/src/main/resources/start.d/900-demo.ini
rename tests/test-webapps/test-jaas-webapp/src/main/config/{etc => webapps.demo/test-jaas.d}/login.conf (56%)
rename tests/test-webapps/test-jaas-webapp/src/main/config/{etc => webapps.demo/test-jaas.d}/login.properties (100%)
delete mode 100644 tests/test-webapps/test-jetty-webapp/src/main/config/etc/jetty-demo.xml
delete mode 100644 tests/test-webapps/test-jetty-webapp/src/main/config/start.d/900-demo.ini
diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml
index 2ed6b82ff93..e06e1fbf448 100644
--- a/jetty-distribution/pom.xml
+++ b/jetty-distribution/pom.xml
@@ -103,6 +103,36 @@
${assembly-directory}/webapps.demo
test.war
+
+ org.eclipse.jetty.tests
+ test-jaas-webapp
+ ${project.version}
+ war
+ true
+ **
+ ${assembly-directory}/webapps.demo
+ test-jaas.war
+
+
+ org.eclipse.jetty.tests
+ test-jndi-webapp
+ ${project.version}
+ war
+ true
+ **
+ ${assembly-directory}/webapps.demo
+ test-jndi.war
+
+
+ org.eclipse.jetty.tests
+ test-spec-webapp
+ ${project.version}
+ war
+ true
+ **
+ ${assembly-directory}/webapps.demo
+ test-spec.war
+
org.eclipse.jetty
test-proxy-webapp
@@ -173,6 +203,7 @@
+
unpack-setuid-config
process-resources
@@ -193,6 +224,70 @@
+
+
+ unpack-test-jaas-config
+ process-resources
+
+ unpack
+
+
+
+
+ org.eclipse.jetty.tests
+ test-jaas-webapp
+ ${project.version}
+ config
+ jar
+ true
+ ${assembly-directory}
+
+
+
+
+
+
+ unpack-test-jndi-config
+ process-resources
+
+ unpack
+
+
+
+
+ org.eclipse.jetty.tests
+ test-jndi-webapp
+ ${project.version}
+ config
+ jar
+ true
+ ${assembly-directory}
+
+
+
+
+
+
+ unpack-test-spec-config
+ process-resources
+
+ unpack
+
+
+
+
+ org.eclipse.jetty.tests
+ test-spec-webapp
+ ${project.version}
+ config
+ jar
+ true
+ ${assembly-directory}
+
+
+
+
+
copy-lib-deps
generate-resources
diff --git a/jetty-distribution/src/main/resources/etc/jetty-demo.xml b/jetty-distribution/src/main/resources/etc/jetty-demo.xml
new file mode 100644
index 00000000000..4dc0aaebcc5
--- /dev/null
+++ b/jetty-distribution/src/main/resources/etc/jetty-demo.xml
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
+
+
+ [
+
+
+
+ /webapps.demo
+ /etc/webdefault.xml
+ 1
+ true
+
+
+
+
+
+
+ ]
+
+
+
+
+
+ [
+
+
+
+
+
+
+
+
+
+
+
+ /favicon.ico
+ Cache-Control
+ Max-Age=3600,public
+ true
+
+
+
+
+
+
+
+
+ /test/rewrite/
+ /test/rewrite/info.html
+
+
+
+
+
+
+
+
+ /test/some/old/context
+ /test/rewritten/newcontext
+
+
+
+
+
+
+
+
+ /test/rewrite/for/*
+ /test/rewritten/
+
+
+
+
+
+
+
+
+ (.*?)/reverse/([^/]*)/(.*)
+ $1/reverse/$3/$2
+
+
+
+
+
+
+
+
+ /*
+ visited
+ yes
+
+
+
+
+
+
+
+
+ /test/redirect/*
+ /test/redirected
+
+
+
+
+
+
+
+
+ /400Error
+ 400
+ ResponsePatternRule Demo
+
+
+
+ ]
+
diff --git a/jetty-distribution/src/main/resources/start.d/900-demo.ini b/jetty-distribution/src/main/resources/start.d/900-demo.ini
new file mode 100644
index 00000000000..fc153adc401
--- /dev/null
+++ b/jetty-distribution/src/main/resources/start.d/900-demo.ini
@@ -0,0 +1,53 @@
+
+# ===========================================================
+# Enable the demonstration web applications
+#
+# To disable the demos, either delete this file, move it out of
+# the start.d directory or rename it to not end with ".ini"
+# ===========================================================
+
+# ===========================================================
+# Enable rewrite handler
+# -----------------------------------------------------------
+OPTIONS=rewrite
+etc/jetty-rewrite.xml
+
+# ===========================================================
+# Add a deploy app provider to scan the webapps.demo directory
+# -----------------------------------------------------------
+etc/jetty-demo.xml
+
+# ===========================================================
+# Enable the Jetty HTTP client APIs for use by demo webapps
+# -----------------------------------------------------------
+OPTIONS=client
+
+# ===========================================================
+# Enable the test-realm login service for use by authentication
+# demonstrations
+# -----------------------------------------------------------
+etc/test-realm.xml
+
+# ===========================================================
+# Enable JAAS test webapp
+# -----------------------------------------------------------
+OPTIONS=jaas
+jaas.login.conf=webapps.demo/test-jaas.d/login.conf
+etc/jetty-jaas.xml
+
+# ===========================================================
+# Enable JNDI test webapp
+# -----------------------------------------------------------
+OPTIONS=jndi,jndi.demo
+
+# ===========================================================
+# Enable additional webapp environment configurators
+# -----------------------------------------------------------
+OPTIONS=plus
+etc/jetty-plus.xml
+
+# ===========================================================
+# Enable servlet 3.1 annotations
+# -----------------------------------------------------------
+OPTIONS=annotations
+etc/jetty-annotations.xml
diff --git a/jetty-distribution/src/main/resources/start.ini b/jetty-distribution/src/main/resources/start.ini
index 33bd90d7434..fdd010282f0 100644
--- a/jetty-distribution/src/main/resources/start.ini
+++ b/jetty-distribution/src/main/resources/start.ini
@@ -96,7 +96,18 @@ etc/jetty-jmx.xml
OPTIONS=jsp
#===========================================================
-# Server logging.
+# Request logger
+# Will add a handler to log all HTTP requests to a standard
+# request log format file.
+#-----------------------------------------------------------
+# requestlog.retain=90
+# requestlog.append=true
+# requestlog.extended=true
+# etc/jetty-requestlog.xml
+
+
+#===========================================================
+# stderr/stdout logging.
# The following configuration will redirect stderr and stdout
# to file which is rolled over daily.
#-----------------------------------------------------------
@@ -176,26 +187,30 @@ etc/jetty-http.xml
etc/jetty-deploy.xml
-#===========================================================
-# Annotations JNDI JAAS processing
-#-----------------------------------------------------------
+# ===========================================================
+# Enable JAAS
+# -----------------------------------------------------------
+# OPTIONS=jaas
+# jaas.login.conf=etc/login.conf
+# etc/jetty-jaas.xml
+
+# ===========================================================
+# Enable JNDI
+# -----------------------------------------------------------
+# OPTIONS=jndi
+
+# ===========================================================
+# Enable additional webapp environment configurators
+# -----------------------------------------------------------
# OPTIONS=plus
# etc/jetty-plus.xml
+
+# ===========================================================
+# Enable servlet 3.1 annotations
+# -----------------------------------------------------------
# OPTIONS=annotations
# etc/jetty-annotations.xml
-
-#===========================================================
-# Request logger
-# Will add a handler to log all HTTP requests to a standard
-# request log format file.
-#-----------------------------------------------------------
-# requestlog.retain=90
-# requestlog.append=true
-# requestlog.extended=true
-# etc/jetty-requestlog.xml
-
-
#===========================================================
# Other server features
#-----------------------------------------------------------
diff --git a/jetty-distribution/src/main/resources/webapps.demo/ROOT/index.html b/jetty-distribution/src/main/resources/webapps.demo/ROOT/index.html
index 826974f2430..8f73374d37a 100644
--- a/jetty-distribution/src/main/resources/webapps.demo/ROOT/index.html
+++ b/jetty-distribution/src/main/resources/webapps.demo/ROOT/index.html
@@ -34,8 +34,9 @@
@@ -44,6 +45,8 @@
diff --git a/jetty-jaas/src/main/config/etc/jetty-jaas.xml b/jetty-jaas/src/main/config/etc/jetty-jaas.xml
index e3994785dcd..74948981932 100644
--- a/jetty-jaas/src/main/config/etc/jetty-jaas.xml
+++ b/jetty-jaas/src/main/config/etc/jetty-jaas.xml
@@ -11,7 +11,7 @@
java.security.auth.login.config
- /etc/login.conf
+ /
diff --git a/jetty-rewrite/src/main/config/etc/jetty-rewrite.xml b/jetty-rewrite/src/main/config/etc/jetty-rewrite.xml
index fd0a891da8e..e13a162291b 100644
--- a/jetty-rewrite/src/main/config/etc/jetty-rewrite.xml
+++ b/jetty-rewrite/src/main/config/etc/jetty-rewrite.xml
@@ -16,101 +16,9 @@
- true
- false
- requestedPath
-
-
-
-
-
-
-
-
-
-
-
-
- /favicon.ico
- Cache-Control
- Max-Age=3600,public
- true
-
-
-
-
-
-
-
-
- /test/rewrite/
- /test/rewrite/info.html
-
-
-
-
-
-
-
-
- /test/some/old/context
- /test/rewritten/newcontext
-
-
-
-
-
-
-
-
- /test/rewrite/for/*
- /test/rewritten/
-
-
-
-
-
-
-
-
- (.*?)/reverse/([^/]*)/(.*)
- $1/reverse/$3/$2
-
-
-
-
-
-
-
-
- /*
- visited
- yes
-
-
-
-
-
-
-
-
- /test/redirect/*
- /test/redirected
-
-
-
-
-
-
-
-
- /400Error
- 400
- ResponsePatternRule Demo
-
-
-
-
+
+
+
diff --git a/tests/test-webapps/test-jaas-webapp/pom.xml b/tests/test-webapps/test-jaas-webapp/pom.xml
index a743267f12c..c7f27b184ed 100644
--- a/tests/test-webapps/test-jaas-webapp/pom.xml
+++ b/tests/test-webapps/test-jaas-webapp/pom.xml
@@ -34,7 +34,7 @@
java.security.auth.login.config
- ${basedir}/src/main/config/etc/login.conf
+ ${basedir}/src/main/config/webapps.demo/test-jaas.d/login.conf
diff --git a/tests/test-webapps/test-jaas-webapp/src/main/assembly/config.xml b/tests/test-webapps/test-jaas-webapp/src/main/assembly/config.xml
index 04effeab037..3fca8c6d0af 100644
--- a/tests/test-webapps/test-jaas-webapp/src/main/assembly/config.xml
+++ b/tests/test-webapps/test-jaas-webapp/src/main/assembly/config.xml
@@ -11,7 +11,7 @@
webapps/test-jaas.xml
- etc/**
+ **
diff --git a/tests/test-webapps/test-jaas-webapp/src/main/config/etc/login.conf b/tests/test-webapps/test-jaas-webapp/src/main/config/webapps.demo/test-jaas.d/login.conf
similarity index 56%
rename from tests/test-webapps/test-jaas-webapp/src/main/config/etc/login.conf
rename to tests/test-webapps/test-jaas-webapp/src/main/config/webapps.demo/test-jaas.d/login.conf
index c7a21038484..0978de6f381 100644
--- a/tests/test-webapps/test-jaas-webapp/src/main/config/etc/login.conf
+++ b/tests/test-webapps/test-jaas-webapp/src/main/config/webapps.demo/test-jaas.d/login.conf
@@ -1,5 +1,5 @@
xyz {
org.eclipse.jetty.jaas.spi.PropertyFileLoginModule required
debug="true"
-file="${jetty.home}/etc/login.properties";
+file="${jetty.home}/webapps.demo/test-jaas.d/login.properties";
};
diff --git a/tests/test-webapps/test-jaas-webapp/src/main/config/etc/login.properties b/tests/test-webapps/test-jaas-webapp/src/main/config/webapps.demo/test-jaas.d/login.properties
similarity index 100%
rename from tests/test-webapps/test-jaas-webapp/src/main/config/etc/login.properties
rename to tests/test-webapps/test-jaas-webapp/src/main/config/webapps.demo/test-jaas.d/login.properties
diff --git a/tests/test-webapps/test-jaas-webapp/src/main/config/webapps.demo/test-jaas.xml b/tests/test-webapps/test-jaas-webapp/src/main/config/webapps.demo/test-jaas.xml
index 1720ba911b9..f3b0a18b1a4 100644
--- a/tests/test-webapps/test-jaas-webapp/src/main/config/webapps.demo/test-jaas.xml
+++ b/tests/test-webapps/test-jaas-webapp/src/main/config/webapps.demo/test-jaas.xml
@@ -7,7 +7,7 @@
/test-jaas
- /webapps/test-jaas.war
+ /test-jaas.war
true
diff --git a/tests/test-webapps/test-jaas-webapp/src/main/webapp/auth.html b/tests/test-webapps/test-jaas-webapp/src/main/webapp/auth.html
index 829c925b8bb..1b476529088 100644
--- a/tests/test-webapps/test-jaas-webapp/src/main/webapp/auth.html
+++ b/tests/test-webapps/test-jaas-webapp/src/main/webapp/auth.html
@@ -5,8 +5,8 @@
- Congratulations, you are AUTHENTICATED and web AUTHORIZED
- Well done. In order to see this page, you must have been JAAS authentictated using the
+ SUCCESS! You are AUTHENTICATED and AUTHORIZED
+ In order to see this page, you must have been JAAS authentictated using the
configured Login Module. You have also been AUTHORIZED according to this webapp's role-based web security constraints.
To logout click:
diff --git a/tests/test-webapps/test-jaas-webapp/src/main/webapp/index.html b/tests/test-webapps/test-jaas-webapp/src/main/webapp/index.html
index 62b744fa650..1ceec84d622 100644
--- a/tests/test-webapps/test-jaas-webapp/src/main/webapp/index.html
+++ b/tests/test-webapps/test-jaas-webapp/src/main/webapp/index.html
@@ -22,26 +22,17 @@
JAAS Authentication and Authorization Demo
Preparation
-
- - You will need to edit your $JETTY_HOME/start.ini file and add the following lines:
+
To enable JAAS, edit your start.ini or start.d/*.ini files and add the following lines:
OPTIONS=jaas
+ jaas.login.conf=etc/login.conf
etc/jetty-jaas.xml
-
-
- - Unjar the test-jaas-webapp-<version>-config.jar inside $JETTY_HOME. The following files will be added:
-
- etc/login.conf
- etc/login.properties
- contexts/test-jaas.xml
-
-
-
-
- Now start jetty as usual.
-
+
+ For the jetty distribution demos, jaas is already enabled in the start.d/900-demo.ini file and sets the jaas.login.conf property to webapps.demo/test-jaas.d/login.conf for use with the webapps.demo/test-jaas.war web application.
+The full source of this demonstration is available here.
Using the Demo
diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/etc/jetty-demo.xml b/tests/test-webapps/test-jetty-webapp/src/main/config/etc/jetty-demo.xml
deleted file mode 100644
index 938e7cf213d..00000000000
--- a/tests/test-webapps/test-jetty-webapp/src/main/config/etc/jetty-demo.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- /webapps.demo
- /etc/webdefault.xml
- 1
- true
-
-
-
-
-
-
-
diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/start.d/900-demo.ini b/tests/test-webapps/test-jetty-webapp/src/main/config/start.d/900-demo.ini
deleted file mode 100644
index 59ea3a6e8ca..00000000000
--- a/tests/test-webapps/test-jetty-webapp/src/main/config/start.d/900-demo.ini
+++ /dev/null
@@ -1,26 +0,0 @@
-
-# ===========================================================
-# Enable the demonstration web applications
-#
-# To disable the demos, either delete this file, move it out of
-# the start.d directory or rename it to not end with ".ini"
-# ===========================================================
-
-
-# ===========================================================
-# Add a deploy app provider to scan the webapps.demo directory
-# -----------------------------------------------------------
-etc/jetty-demo.xml
-
-
-# ===========================================================
-# Enable the Jetty HTTP client APIs for use by demo webapps
-# -----------------------------------------------------------
-OPTIONS=client
-
-
-# ===========================================================
-# Enable the test-realm login service for use by authentication
-# demonstrations
-# -----------------------------------------------------------
-etc/test-realm.xml
diff --git a/tests/test-webapps/test-jetty-webapp/src/main/webapp/index.html b/tests/test-webapps/test-jetty-webapp/src/main/webapp/index.html
index c088e0ec3f2..c81fcb94a29 100644
--- a/tests/test-webapps/test-jetty-webapp/src/main/webapp/index.html
+++ b/tests/test-webapps/test-jetty-webapp/src/main/webapp/index.html
@@ -13,49 +13,37 @@
Welcome to Jetty 9
-This is the Test webapp for the Jetty 9 HTTP Server and Servlet Container.
-For more information about Jetty, please visit our
-website
-or documentation hub.
-Commercial support for Jetty is available via Webtide and Intalio.
-
-
-This is a test context that serves:
-
+This is the Test webapp for the Jetty 9 HTTP Server and Servlet Container. It is
+deployed in $JETTY_HOME/webapp.demo and configured by $JETTY_HOME/start.d/900-demo.ini
+- Servet: Hello World
+- Dump: Request, Session, Cookie
+- JSP: examples
+- Comet Chat: Long Polling, WebSocket
+- Authentication
+- Dispatcher Servlet
+- Request Rewrite Servlet
- static content:
tiny,
small,
medium,
large,
large gziped
-- Hello World Servlet
-- Dump: Request, Session, Cookie
-- Dispatcher Servlet
-- Request Rewrite Servlet
-- JSP examples
-- Comet Chat: Long Polling, WebSocket
-- Authentication
-
-
-
-This webapp is deployed in $JETTY_HOME/webapp/test and configured by $JETTY_HOME/contexts/test.xml
+
+
+MAIN MENU
+