JBoss Community

JBoss AS7 : Security Domain Model

new comment by Maly Velky View all comments on this document

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:

  1. Download custom_module.zipand form-auth.war from JBossAS7SecurityCustomLoginModules article
  2. 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
  3. Modify <JBoss AS 7.1.0.Final>/standalone/configuration/standalone.xml by adding the security domain shown below
  4. 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>

...

 

----