Skip to content

Commit 0981c22

Browse files
committed
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <[email protected]>
2 parents 5b1c0b8 + 4d0ecf2 commit 0981c22

File tree

3 files changed

+100
-57
lines changed

3 files changed

+100
-57
lines changed

jetty-core/jetty-security/src/test/java/org.eclipse.jetty.security.jaas/JAASLdapLoginServiceTest.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,15 @@
4545
import org.eclipse.jetty.server.LocalConnector;
4646
import org.eclipse.jetty.server.Server;
4747
import org.junit.Test;
48+
import org.junit.jupiter.api.condition.EnabledForJreRange;
49+
import org.junit.jupiter.api.condition.JRE;
4850
import org.junit.runner.RunWith;
4951
5052
import static java.nio.charset.StandardCharsets.ISO_8859_1;
5153
import static org.hamcrest.MatcherAssert.assertThat;
5254
import static org.hamcrest.Matchers.startsWith;
5355
56+
@EnabledForJreRange(max = JRE.JAVA_17, disabledReason = "sun.security.x509.X509CertInfo.set not present in Java 21, needs a Java 21 compatible version of Apache Directory Server")
5457
@RunWith(FrameworkRunner.class)
5558
@CreateLdapServer(transports = {@CreateTransport(protocol = "LDAP")})
5659
@CreateDS(allowAnonAccess = false, partitions = {
@@ -170,7 +173,7 @@ public static void setLdapServer(LdapServer ldapServer)
170173
private Server _server;
171174
private LocalConnector _connector;
172175
private ServletContextHandler _context;
173-
176+
174177
public void setUp() throws Exception
175178
{
176179
_server = new Server();
@@ -198,14 +201,14 @@ private String doLogin(String username, String password, List<String> hasRoles,
198201
{
199202
JAASLoginService ls = jaasLoginService("foo");
200203
_server.addBean(ls, true);
201-
204+
202205
_context.setServletHandler(new ServletHandler());
203206
ServletHolder holder = new ServletHolder();
204207
holder.setServlet(new TestServlet(hasRoles, hasntRoles));
205208
_context.getServletHandler().addServletWithMapping(holder, "/");
206-
209+
207210
_server.start();
208-
211+
209212
return _connector.getResponse("GET /ctx/test HTTP/1.0\n" + "Authorization: Basic " +
210213
Base64.getEncoder().encodeToString((username + ":" + password).getBytes(ISO_8859_1)) + "\n\n");
211214
}
@@ -218,28 +221,28 @@ public void testLdapUserIdentity() throws Exception
218221
ServletHolder holder = new ServletHolder();
219222
holder.setServlet(new TestServlet(Arrays.asList("developers", "admin"), Arrays.asList("blabla")));
220223
_context.getServletHandler().addServletWithMapping(holder, "/");
221-
224+
222225
JAASLoginService ls = new JAASLoginService("foo");
223226
ls.setCallbackHandlerClass("org.eclipse.jetty.ee10.jaas.callback.DefaultCallbackHandler");
224227
ls.setIdentityService(new DefaultIdentityService());
225228
ls.setConfiguration(new TestConfiguration(false));
226-
229+
227230
_server.addBean(ls, true);
228231
_server.start();
229-
232+
230233
String response = _connector.getResponse("GET /ctx/test HTTP/1.0\n" + "Authorization: Basic " +
231234
Base64.getEncoder().encodeToString("someone:complicatedpassword".getBytes(ISO_8859_1)) + "\n\n");
232235
assertThat(response, startsWith("HTTP/1.1 200 OK"));
233-
236+
234237
_server.stop();
235-
238+
236239
_context.setServletHandler(new ServletHandler());
237240
holder = new ServletHolder();
238241
holder.setServlet(new TestServlet(Arrays.asList("admin"), Arrays.asList("developers, blabla")));
239242
_context.getServletHandler().addServletWithMapping(holder, "/");
240-
243+
241244
_server.start();
242-
245+
243246
response = _connector.getResponse("GET /ctx/test HTTP/1.0\n" + "Authorization: Basic " +
244247
Base64.getEncoder().encodeToString("someoneelse:verycomplicatedpassword".getBytes(ISO_8859_1)) + "\n\n");
245248
assertThat(response, startsWith("HTTP/1.1 200 OK"));
@@ -259,8 +262,8 @@ public void testLdapUserIdentityBindingLogin() throws Exception
259262
ls.setConfiguration(new TestConfiguration(true));
260263
_server.addBean(ls, true);
261264
_server.start();
262-
263-
265+
266+
264267
String response = _connector.getResponse("GET /ctx/test HTTP/1.0\n" + "Authorization: Basic " +
265268
Base64.getEncoder().encodeToString("someone:complicatedpassword".getBytes(ISO_8859_1)) + "\n\n");
266269
assertThat(response, startsWith("HTTP/1.1 200 OK"));
@@ -276,10 +279,10 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
276279
if (req.getUserPrincipal() == null)
277280
req.authenticate(resp);
278281
}
279-
282+
280283
}, "/");
281284
_server.start();
282-
285+
283286
//TODO this test shows response already committed!
284287
response = _connector.getResponse("GET /ctx/test HTTP/1.0\n" + "Authorization: Basic " +
285288
Base64.getEncoder().encodeToString("someone:wrongpassword".getBytes(ISO_8859_1)) + "\n\n");
@@ -312,6 +315,5 @@ public void testLdapBindingSubdirAmbiguousUserName() throws Exception
312315
String response = doLogin("ambiguousone", "barfoo", null, null);
313316
assertThat(response, startsWith("HTTP/1.1 " + HttpServletResponse.SC_UNAUTHORIZED));
314317
}
315-
316-
*/
318+
*/
317319
}

jetty-home/src/main/resources/bin/jetty.sh

Lines changed: 71 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ started()
137137
local STATEFILE=$1
138138
local PIDFILE=$2
139139
local STARTTIMEOUT=$3
140+
141+
if (( DEBUG )) ; then
142+
echo "Looking for $STATEFILE"
143+
echo -n "State Parent Directory: "
144+
ls -lad $(dirname $STATEFILE)
145+
fi
146+
140147
# wait till timeout to see "STARTED" in state file, needs --module=state as argument
141148
for ((T = 0; T < $STARTTIMEOUT; T++))
142149
do
@@ -162,6 +169,11 @@ started()
162169
done
163170
(( DEBUG )) && echo "Timeout $STARTTIMEOUT expired waiting for start state from $STATEFILE"
164171
echo " timeout"
172+
if running "$PIDFILE" ; then
173+
echo "INFO: Server process is running"
174+
else
175+
echo "** ERROR: Server process is NOT running"
176+
fi
165177
return 1;
166178
}
167179

@@ -173,7 +185,7 @@ pidKill()
173185
if [ -r $PIDFILE ] ; then
174186
local PID=$(tail -1 "$PIDFILE")
175187
if [ -z "$PID" ] ; then
176-
echo "ERROR: no pid found in $PIDFILE"
188+
echo "** ERROR: no pid found in $PIDFILE"
177189
return 1
178190
fi
179191

@@ -204,7 +216,6 @@ pidKill()
204216
fi
205217
}
206218

207-
208219
readConfig()
209220
{
210221
(( DEBUG )) && echo "Reading $1.."
@@ -213,26 +224,25 @@ readConfig()
213224

214225
dumpEnv()
215226
{
216-
echo "JAVA = $JAVA"
217-
echo "JAVA_OPTIONS = ${JAVA_OPTIONS[*]}"
218-
echo "JETTY_HOME = $JETTY_HOME"
219-
echo "JETTY_BASE = $JETTY_BASE"
220-
echo "START_D = $START_D"
221-
echo "START_INI = $START_INI"
222-
echo "JETTY_START = $JETTY_START"
223-
echo "JETTY_CONF = $JETTY_CONF"
224-
echo "JETTY_ARGS = ${JETTY_ARGS[*]}"
225-
echo "JETTY_RUN = $JETTY_RUN"
226-
echo "JETTY_PID = $JETTY_PID"
227-
echo "JETTY_START_LOG = $JETTY_START_LOG"
228-
echo "JETTY_STATE = $JETTY_STATE"
229-
echo "JETTY_START_TIMEOUT = $JETTY_START_TIMEOUT"
230-
echo "JETTY_SYS_PROPS = $JETTY_SYS_PROPS"
231-
echo "RUN_ARGS = ${RUN_ARGS[*]}"
227+
echo "JAVA = $JAVA"
228+
echo "JAVA_OPTIONS = ${JAVA_OPTIONS[*]}"
229+
echo "JETTY_HOME = $JETTY_HOME"
230+
echo "JETTY_BASE = $JETTY_BASE"
231+
echo "START_D = $START_D"
232+
echo "START_INI = $START_INI"
233+
echo "JETTY_START = $JETTY_START"
234+
echo "JETTY_CONF = $JETTY_CONF"
235+
echo "JETTY_ARGS = ${JETTY_ARGS[*]}"
236+
echo "JETTY_RUN = $JETTY_RUN"
237+
echo "JETTY_PID = $JETTY_PID"
238+
echo "JETTY_START_LOG = $JETTY_START_LOG"
239+
echo "JETTY_STATE = $JETTY_STATE"
240+
echo "JETTY_START_TIMEOUT = $JETTY_START_TIMEOUT"
241+
echo "JETTY_SYS_PROPS = $JETTY_SYS_PROPS"
242+
echo "RUN_ARGS = ${RUN_ARGS[*]}"
232243
}
233244

234245

235-
236246
##################################################
237247
# Get the action & configs
238248
##################################################
@@ -358,7 +368,15 @@ fi
358368
if [ -z "$JETTY_RUN" ]
359369
then
360370
JETTY_RUN=$(findDirectory -w /var/run /usr/var/run $JETTY_BASE /tmp)/jetty
361-
[ -d "$JETTY_RUN" ] || mkdir $JETTY_RUN
371+
fi
372+
373+
if [ ! -d "$JETTY_RUN" ] ; then
374+
if ! mkdir $JETTY_RUN
375+
then
376+
echo "** ERROR: Unable to create directory: $JETTY_RUN"
377+
echo " Correct issues preventing the creation of \$JETTY_RUN and try again."
378+
exit 1
379+
fi
362380
fi
363381

364382
#####################################################
@@ -495,6 +513,11 @@ RUN_ARGS=($JETTY_SYS_PROPS ${JETTY_DRY_RUN[@]})
495513

496514
if (( DEBUG ))
497515
then
516+
if expr "${RUN_ARGS[*]}" : '.*/etc/console-capture.xml.*' > /dev/null
517+
then
518+
echo "WARNING: Disable console-capture module for best DEBUG results"
519+
fi
520+
echo "IDs are $(id)"
498521
dumpEnv
499522
fi
500523

@@ -503,13 +526,27 @@ fi
503526
##################################################
504527
case "$ACTION" in
505528
start)
506-
echo -n "Starting Jetty: "
507-
508529
if (( NO_START )); then
509530
echo "Not starting ${NAME} - NO_START=1";
510531
exit
511532
fi
512533

534+
if ! touch "$JETTY_PID"
535+
then
536+
echo "** ERROR: Unable to touch file: $JETTY_PID"
537+
echo " Correct issues preventing use of \$JETTY_PID and try again."
538+
exit 1
539+
fi
540+
541+
if ! touch "$JETTY_STATE"
542+
then
543+
echo "** ERROR: Unable to touch file: $JETTY_STATE"
544+
echo " Correct issues preventing use of \$JETTY_STATE and try again."
545+
exit 1
546+
fi
547+
548+
echo -n "Starting Jetty: "
549+
513550
# Startup from a service file
514551
if [ $UID -eq 0 ] && type start-stop-daemon > /dev/null 2>&1
515552
then
@@ -519,15 +556,16 @@ case "$ACTION" in
519556
CH_USER="--chuid $JETTY_USER"
520557
fi
521558

522-
echo ${RUN_ARGS[@]} start-log-file="$JETTY_START_LOG" | xargs start-stop-daemon \
559+
echo ${RUN_ARGS[@]} --start-log-file="$JETTY_START_LOG" | xargs start-stop-daemon \
523560
--start $CH_USER \
524561
--pidfile "$JETTY_PID" \
525562
--chdir "$JETTY_BASE" \
526563
--background \
564+
--output "${JETTY_RUN}/start-stop.log"
527565
--make-pidfile \
528566
--startas "$JAVA" \
529567
--
530-
568+
(( DEBUG )) && echo "Starting: start-stop-daemon"
531569
else
532570

533571
if running $JETTY_PID
@@ -545,16 +583,19 @@ case "$ACTION" in
545583
SU_SHELL="-s $JETTY_SHELL"
546584
fi
547585

548-
touch "$JETTY_PID"
549586
chown "$JETTY_USER" "$JETTY_PID"
550587
su - "$JETTY_USER" $SU_SHELL -c "
551588
cd \"$JETTY_BASE\"
552-
echo ${RUN_ARGS[*]} start-log-file=\"$JETTY_START_LOG\" | xargs ${JAVA} > /dev/null &
553-
disown \$!"
589+
echo ${RUN_ARGS[*]} --start-log-file=\"$JETTY_START_LOG\" | xargs ${JAVA} > /dev/null &
590+
PID=\$!
591+
disown \$PID"
592+
(( DEBUG )) && echo "Starting: su shell (w/user $JETTY_USER) on PID $PID"
554593
else
555594
# Startup if not switching users
556-
echo ${RUN_ARGS[*]} | xargs ${JAVA} > /dev/null &
557-
disown $!
595+
echo ${RUN_ARGS[*]} --start-log-file="${JETTY_START_LOG}" | xargs ${JAVA} > /dev/null &
596+
PID=$!
597+
disown $PID
598+
(( DEBUG )) && echo "Starting: java command on PID $PID"
558599
fi
559600

560601
fi
@@ -592,7 +633,7 @@ case "$ACTION" in
592633
else
593634
# Stop from a non-service path
594635
if [ ! -r "$JETTY_PID" ] ; then
595-
echo "ERROR: no pid found at $JETTY_PID"
636+
echo "** ERROR: no pid found at $JETTY_PID"
596637
exit 1
597638
fi
598639

pom.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@
3434
<!-- dependency versions -->
3535
<alpn.agent.version>2.0.10</alpn.agent.version>
3636
<ant.version>1.10.14</ant.version>
37-
<apache.avro.version>1.11.2</apache.avro.version>
37+
<apache.avro.version>1.11.3</apache.avro.version>
3838
<apache.httpclient.version>4.5.14</apache.httpclient.version>
3939
<apache.httpcore.version>4.4.16</apache.httpcore.version>
40-
<asciidoctorj-diagram.version>2.2.11</asciidoctorj-diagram.version>
40+
<asciidoctorj-diagram.version>2.2.13</asciidoctorj-diagram.version>
4141
<asciidoctorj.version>2.5.10</asciidoctorj.version>
42-
<mina.core.version>2.2.2</mina.core.version>
43-
<asm.version>9.5</asm.version>
42+
<mina.core.version>2.2.3</mina.core.version>
43+
<asm.version>9.6</asm.version>
4444
<awaitility.version>4.2.0</awaitility.version>
4545
<bndlib.version>6.4.1</bndlib.version>
4646
<build-support.version>1.5</build-support.version>
4747
<checkstyle.version>10.6.0</checkstyle.version>
4848
<commons-codec.version>1.16.0</commons-codec.version>
4949
<commons.compress.version>1.24.0</commons.compress.version>
50-
<commons.io.version>2.13.0</commons.io.version>
50+
<commons.io.version>2.14.0</commons.io.version>
5151
<commons-lang3.version>3.13.0</commons-lang3.version>
5252
<conscrypt.version>2.5.2</conscrypt.version>
5353
<disruptor.version>3.4.2</disruptor.version>
@@ -88,7 +88,7 @@
8888
<jboss.logging.processor.version>2.2.1.Final</jboss.logging.processor.version>
8989
<jboss.logging.version>3.5.3.Final</jboss.logging.version>
9090
<jboss-logmanager.version>3.0.2.Final</jboss-logmanager.version>
91-
<jboss-threads.version>3.5.0.Final</jboss-threads.version>
91+
<jboss-threads.version>3.5.1.Final</jboss-threads.version>
9292
<jetty-assembly-descriptors.version>1.1</jetty-assembly-descriptors.version>
9393
<jetty.perf-helper.version>1.0.7</jetty.perf-helper.version>
9494
<jetty-quiche-native.version>0.18.0</jetty-quiche-native.version>
@@ -109,7 +109,7 @@
109109
<maven.deps.version>3.9.4</maven.deps.version>
110110
<maven-build-cache.version>1.0.1</maven-build-cache.version>
111111
<maven-artifact-transfer.version>0.13.1</maven-artifact-transfer.version>
112-
<maven.resolver.version>1.9.15</maven.resolver.version>
112+
<maven.resolver.version>1.9.16</maven.resolver.version>
113113
<maven.version>3.9.0</maven.version>
114114
<mongodb.version>3.12.11</mongodb.version>
115115
<netty.version>4.1.97.Final</netty.version>
@@ -119,7 +119,7 @@
119119
<org.osgi.util.function.version>1.2.0</org.osgi.util.function.version>
120120
<org.osgi.util.promise.version>1.3.0</org.osgi.util.promise.version>
121121

122-
<osgi-version>3.18.400</osgi-version>
122+
<osgi-version>3.18.500</osgi-version>
123123
<!-- really used -->
124124
<osgi-services-version>3.11.100</osgi-services-version>
125125
<osgi-service-cm-version>1.6.1</osgi-service-cm-version>
@@ -169,7 +169,7 @@
169169
<maven.compiler.plugin.version>3.11.0</maven.compiler.plugin.version>
170170
<maven.dependency.plugin.version>3.6.0</maven.dependency.plugin.version>
171171
<maven.deploy.plugin.version>3.1.1</maven.deploy.plugin.version>
172-
<maven.enforcer.plugin.version>3.4.0</maven.enforcer.plugin.version>
172+
<maven.enforcer.plugin.version>3.4.1</maven.enforcer.plugin.version>
173173
<maven.exec.plugin.version>3.1.0</maven.exec.plugin.version>
174174
<maven.gpg.plugin.version>3.1.0</maven.gpg.plugin.version>
175175
<maven.install.plugin.version>3.1.1</maven.install.plugin.version>
@@ -182,7 +182,7 @@
182182
<maven.release.plugin.version>3.0.1</maven.release.plugin.version>
183183
<maven.remote-resources-plugin.version>3.1.0</maven.remote-resources-plugin.version>
184184
<maven.resources.plugin.version>3.3.1</maven.resources.plugin.version>
185-
<maven.shade.plugin.version>3.5.0</maven.shade.plugin.version>
185+
<maven.shade.plugin.version>3.5.1</maven.shade.plugin.version>
186186
<maven.surefire.plugin.version>3.1.2</maven.surefire.plugin.version>
187187
<maven.source.plugin.version>3.3.0</maven.source.plugin.version>
188188
<maven.war.plugin.version>3.4.0</maven.war.plugin.version>

0 commit comments

Comments
 (0)