3 Replies Latest reply on Aug 17, 2006 8:04 AM by jaikiran

    Configure Custom JAAS Login module in JBoss

    chintan_jboss

      hi,

      I have written Custom Login module using JAAS api. Now i want to configure it for Jboss app server? and i want to authenticate with my mysql db table (login table).

      How can i do that?

      I already configure for Tomcat. for that i kept my login.config file into /JAVA_HOME/lib/security folder.

      What changes i have to make into jboss to configure this?

      Thanks
      chintan

        • 1. Re: Configure Custom JAAS Login module in JBoss
          jaikiran
          • 2. Re: Configure Custom JAAS Login module in JBoss
            chintan_jboss

            Hi Jaikiran,

            Example which you suggested implemets DatabaseServerLoginModule. Let me tell my case in details

            following is my jaas.login.config file

            myloginmodule{
            com.login.test.PasswordLoginModule required

            authenticator = "com.login.test.authenticators.PasswordAuthImpl
            digestAlgo = "SHA1"
            datasource = ""
            };

            now PasswordAuthImpl contains method authenticate(Map, username,pwd) to authenticate user.

            Now my question is where do i put my jaas.login.config file in jboss so that it works as it is. and for db what changes i need to make?

            Thanks
            Chintan

            • 3. Re: Configure Custom JAAS Login module in JBoss
              jaikiran

              Add the following to the login-config.xml file present in %JBOSS_HOME%/server/default/conf directory:

              <application-policy name="com.login.test.PasswordLoginModule">
               <authentication>
               <login-module code="com.login.test.authenticators.PasswordAuthImpl" flag="required">
               <module-option name="digestAlgo">SHA1</module-option>
               </login-module>
               </authentication>
               </application-policy>


              As far creating the login module *configuration* in your own file(jaas.login.config) is concerned, i havent tried it myself, but here's an extract that i found from http://members.capmac.org/~orb/blog.cgi/tech/java/jaas_jboss.html

              The documentation suggest that you can place an applications specific login-config.xml in your ear file, but I wasn't able to make it work. However, even though you provide the LoginModule definition in the global login-config.xml, you can still provide the implementation classes in your ear/war file. (you don't have to deploy the LoginModule separately)