Simple Java web application template with the secured content.
You should have git installed
$ git clone git://github.com/kwart/secured-webapp-template.git
or you can download current sources as a zip file
You need to have Maven installed
$ cd secured-webapp-template
$ mvn clean package
If the target container doesn't include JSTL implementation, then set the jstl
property while calling the Maven build
$ mvn clean package -Djstl
Copy the produced secured-webapp.war
from the target
folder to the deployment folder of your container.
Open the application URL in the browser. E.g. http://localhost:8080/secured-webapp/
The JBoss specific deployment descriptor (WEB-INF/jboss-web.xml) refers to a web-tests
security domain. You have to add it to your configuration.
Define the new security domain, either by using JBoss CLI (jboss-cli.sh
/ jboss-cli.bat
):
$ ./jboss-cli.sh -c '/subsystem=security/security-domain=web-tests:add(cache-type=default)'
$ ./jboss-cli.sh -c '/subsystem=security/security-domain=web-tests/authentication=classic:add(login-modules=[{"code"=>"UsersRoles", "flag"=>"required"}]) {allow-resource-service-restart=true}'
or by editing standalone/configuration/standalone.xml
, where you have to add a new child to the <security-domains>
element
<security-domain name="web-tests" cache-type="default">
<authentication>
<login-module code="UsersRoles" flag="required"/>
</authentication>
</security-domain>