I am working on a project written in pure jsps (scriptlets) without using any frameworks.
jboss version: jboss-as-7.1.0.Final
Now I am trying to add simple authentication to it. Therefore, when a user tries to use the jsps browser, say, http://localhost/myContextPath/hello.jsp , he first requires a login.
web.xml
<security-constraint> <web-resource-collection> <web-resource-name>All Access</web-resource-name> <url-pattern>/*</url-pattern> <http-method>DELETE</http-method> <http-method>PUT</http-method> <http-method>HEAD</http-method> <http-method>OPTIONS</http-method> <http-method>TRACE</http-method> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> </login-config>
Jboss-web.xml
<jboss-web> <security-domain>other</security-domain> </jboss-web>
standalone.xml ([jboss_home] \ stand-alone \ configuration folder)
<subsystem xmlns="urn:jboss:domain:security:1.1"> <security-domains> <security-domain name="other" cache-type="default"> <authentication> <login-module code="UsersRoles" flag="required"> <module-option name="usersProperties" value="users.properties"/> <module-option name="rolesProperties" value="roles.properties"/> </login-module> </authentication> </security-domain> <security-domain name="form-auth"> <authentication> <login-module code="UsersRoles" flag="required"> <module-option name="usersProperties" value="users.properties"/> <module-option name="rolesProperties" value="roles.properties"/> </login-module> </authentication> </security-domain> </security-domains> </subsystem>
users.properties (placement under webapp classes folder)
user1=jboss7
role.properties (placement under webapp classes folder)
user1=Admin
After all these modifications, I try to use the hello jsp browser. I work as usual. No authentication, and no exceptions.
Iām not sure that I am going in the right direction, or a security restriction is completely different things. Please help, thanks !!!
source share