Skip to content

Commit

Permalink
Issue #11761 fix jetty maven doco and integration test (#11771)
Browse files Browse the repository at this point in the history
* Issue #11761 fix jetty maven doco and integration test
  • Loading branch information
janbartel authored May 12, 2024
1 parent dd611b4 commit 6f2f599
Show file tree
Hide file tree
Showing 25 changed files with 168 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,9 @@ Here's an example of setting up the `HashLoginService` for a webapp:
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config>${project.basedir}/src/etc/realm.properties</config>
<config implementation="org.eclipse.jetty.maven.MavenResource">
<resourceAsString>${basedir}/src/etc/realm.properties</resourceAsString>
</config>
</loginService>
</loginServices>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config>src/test/resources/test-realm.properties</config>
<config implementation="org.eclipse.jetty.maven.MavenResource">
<resourceAsString>src/test/resources/test-realm.properties</resourceAsString>
</config>
</loginService>
</loginServices>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config>src/etc/realm.properties</config>
<config implementation="org.eclipse.jetty.maven.MavenResource">
<resourceAsString>src/etc/realm.properties</resourceAsString>
</config>
</loginService>
</loginServices>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@
</jettyXmls>
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config implementation="org.eclipse.jetty.maven.MavenResource">
<resourceAsString>${basedir}/src/config/login.xml</resourceAsString>
<resourceAsString>${basedir}/src/config/realm.properties</resourceAsString>
</config>
</loginService>
</loginServices>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,24 @@
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Jetty Simple Webapp run-mojo-it</display-name>

<security-constraint>
<web-resource-collection>
<web-resource-name>Any Authenticated User</web-resource-name>
<url-pattern>/auth/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>FORM</auth-method>
<realm-name>Test Realm</realm-name>
<form-login-config>
<form-login-page>/logon.html?param=test</form-login-page>
<form-error-page>/logonError.html?param=test</form-error-page>
</form-login-config>
</login-config>

</web-app>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<html>
<h1>Authenticated</h1>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<html>
<h1>FORM Authentication demo</h1>
<form method="POST" action="j_security_check">
<table border="0" cellspacing="2" cellpadding="1">
<tr>
<td>Username:</td>
<td><input size="12" value="" name="j_username" maxlength="25" type="text"></td>
</tr>
<tr>
<td>Password:</td>
<td><input size="12" value="" name="j_password" maxlength="25" type="password"></td>
</tr>
<tr>
<td colspan="2" align="center">
<input name="submit" type="submit" value="Login">
</td>
</tr>
</table>
</form>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<html>
<h1>Authentication ERROR</h1>
Username, password or role incorrect.
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config>${project.build.testOutputDirectory}/test-realm.properties</config>
<config implementation="org.eclipse.jetty.maven.MavenResource">
<resourceAsString>${project.build.testOutputDirectory}/test-realm.properties</resourceAsString>
</config>
</loginService>
</loginServices>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config>${project.build.directory}/realm.properties</config>
<config implementation="org.eclipse.jetty.maven.MavenResource">
<resourceAsString>${project.build.directory}/realm.properties</resourceAsString>
</config>
</loginService>
</loginServices>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@
</jettyXmls>
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config implementation="org.eclipse.jetty.maven.MavenResource">
<resourceAsString>${basedir}/src/config/login.xml</resourceAsString>
<resourceAsString>${basedir}/src/config/realm.properties</resourceAsString>
</config>
</loginService>
</loginServices>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,24 @@
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Jetty Simple Webapp run-mojo-it</display-name>

<security-constraint>
<web-resource-collection>
<web-resource-name>Any Authenticated User</web-resource-name>
<url-pattern>/auth/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>FORM</auth-method>
<realm-name>Test Realm</realm-name>
<form-login-config>
<form-login-page>/logon.html?param=test</form-login-page>
<form-error-page>/logonError.html?param=test</form-error-page>
</form-login-config>
</login-config>

</web-app>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<html>
<h1>Authenticated</h1>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<html>
<h1>FORM Authentication demo</h1>
<form method="POST" action="j_security_check">
<table border="0" cellspacing="2" cellpadding="1">
<tr>
<td>Username:</td>
<td><input size="12" value="" name="j_username" maxlength="25" type="text"></td>
</tr>
<tr>
<td>Password:</td>
<td><input size="12" value="" name="j_password" maxlength="25" type="password"></td>
</tr>
<tr>
<td colspan="2" align="center">
<input name="submit" type="submit" value="Login">
</td>
</tr>
</table>
</form>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<html>
<h1>Authentication ERROR</h1>
Username, password or role incorrect.
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config>src/test/resources/test-realm.properties</config>
<config implementation="org.eclipse.jetty.maven.MavenResource">
<resourceAsString>src/test/resources/test-realm.properties</resourceAsString>
</config>
</loginService>
</loginServices>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config>src/etc/realm.properties</config>
<config implementation="org.eclipse.jetty.maven.MavenResource">
<resourceAsString>src/etc/realm.properties</resourceAsString>
</config>
</loginService>
</loginServices>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@
</jettyXmls>
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config implementation="org.eclipse.jetty.maven.MavenResource">
<resourceAsString>${basedir}/src/config/login.xml</resourceAsString>
<resourceAsString>${basedir}/src/config/realm.properties</resourceAsString>
</config>
</loginService>
</loginServices>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,24 @@
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Jetty Simple Webapp run-mojo-it</display-name>

<security-constraint>
<web-resource-collection>
<web-resource-name>Any Authenticated User</web-resource-name>
<url-pattern>/auth/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>FORM</auth-method>
<realm-name>Test Realm</realm-name>
<form-login-config>
<form-login-page>/logon.html?param=test</form-login-page>
<form-error-page>/logonError.html?param=test</form-error-page>
</form-login-config>
</login-config>

</web-app>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<html>
<h1>Authenticated</h1>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<html>
<h1>FORM Authentication demo</h1>
<form method="POST" action="j_security_check">
<table border="0" cellspacing="2" cellpadding="1">
<tr>
<td>Username:</td>
<td><input size="12" value="" name="j_username" maxlength="25" type="text"></td>
</tr>
<tr>
<td>Password:</td>
<td><input size="12" value="" name="j_password" maxlength="25" type="password"></td>
</tr>
<tr>
<td colspan="2" align="center">
<input name="submit" type="submit" value="Login">
</td>
</tr>
</table>
</form>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<html>
<h1>Authentication ERROR</h1>
Username, password or role incorrect.
</html>

0 comments on commit 6f2f599

Please sign in to comment.