Issue #11761 fix jetty maven doco and integration test (#11771)

* Issue #11761 fix jetty maven doco and integration test
This commit is contained in:
Jan Bartel 2024-05-13 01:44:13 +02:00 committed by GitHub
parent dd611b4e79
commit 6f2f599b17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 168 additions and 10 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -0,0 +1,3 @@
<html>
<h1>Authenticated</h1>
</html>

View File

@ -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>

View File

@ -0,0 +1,4 @@
<html>
<h1>Authentication ERROR</h1>
Username, password or role incorrect.
</html>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -0,0 +1,3 @@
<html>
<h1>Authenticated</h1>
</html>

View File

@ -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>

View File

@ -0,0 +1,4 @@
<html>
<h1>Authentication ERROR</h1>
Username, password or role incorrect.
</html>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -0,0 +1,3 @@
<html>
<h1>Authenticated</h1>
</html>

View File

@ -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>

View File

@ -0,0 +1,4 @@
<html>
<h1>Authentication ERROR</h1>
Username, password or role incorrect.
</html>