Using custom login module with code inside WAR
The description above wasn't really clear to me so this is how I got it working:
- Download custom_module.zipand form-auth.war from JBossAS7SecurityCustomLoginModules article
- Do one of the following: EITHER: Repackage custom_module.zip/main/custom_module.jar into form-auth.war/WEB-INF/lib/custom_module.jar OR: Extract custom_module.zip/main/custom_module.jar/custom/MyLoginModule.class and repackage it into form-auth.war/WEB-INF/classes/custom/MyLoginModule.class
- Modify <JBoss AS 7.1.0.Final>/standalone/configuration/standalone.xml by adding the security domain shown below
- Start JBoss standalone and deploy the WAR; you should be now able to log-in with user anil, psw anil
standalone.xml security domain snippet:
----
...
<security-domains>
<security-domain name="form-auth" cache-type="default">
<authentication>
<login-module code="custom.MyLoginModule" flag="required">
<module-option name="usersProperties" value="users.properties"/>
<module-option name="rolesProperties" value="roles.properties"/>
</login-module>
</authentication>
</security-domain>
...
----