5 Replies Latest reply on Mar 5, 2004 2:34 PM by jae77

    Dynamically adding LoginModules

    kashifnoorani

      Hello!

      I am outlining the problem that I am facing below. Any help would be very much appreciated.

      There is an application that provides a few default login modules such as ldap, database etc. However, sub-applicatons (sars/wars) that plug into this application, can also provide their own login modules. Authenticating a user would necessitate checking all available LoginModules.

      I have found XMLLoginConfig to be the closest approximation to a solution to this problem. However, it does not allow adding LoginModules to the same application name.

      To illustrate, if I define "TestRealm" and add "LdapLoginModule and "DatabaseLoginModule" to it, I would also like to be able to add "XLoginModule" and "YLoginModule" to "TestRealm", at runtime.

      Is this possible?

      Kash

        • 1. Re: Postgres port
          starksm64

          Just FYI, postgres does support sequences, so that a uique id can be generated via a special sql call to a function, i believe its called nextval(sequence_name). This can even be auto-inserted into a field on the table upon insert, but if the jdbc driver doesnt support the getauto(whatever) function then this will not help.

          Ive used postgres for 4 years now and would be glad to help where needed, Im new to this project so would rather work under anothers direction for now, let me know where any of you require assistance.

          I just joind the forum and must add that I am THRILLED that someone has finally build a good open java cms... how long Ive looked for one, tried building one, and wished something like this would get off the ground!

          • 2. Re: Dynamically adding LoginModules
            jae77

            yes it is, i'm actually working on this myself right now.

            do you have the jboss documentation? chapter 8 talks all about this and there is even example code that you can use right away to get this up an running.

            basically, you create an mbean that will load the login-conf.xml file upon deployment and push it onto the configration stack.

            • 3. Re: Dynamically adding LoginModules
              starksm64

              Use the recently added 3.2 DynamicLoginConfig service:

              jboss-service.xml:

              <server>
               <!-- The custom JAAS login configuration service that installs
               a Configuration capable of dynamically updating the
               config settings
               -->
               <mbean code="org.jboss.security.auth.login.DynamicLoginConfig"
               name="jboss.security.tests:service=DynamicLoginConfig">
               <attribute name="AuthConfig">META-INF/jaas-test-config.xml</attribute>
               <depends optional-attribute-name="LoginConfigService">
               jboss.security:service=XMLLoginConfig
               </depends>
               </mbean>
              
              </server>
              



              • 4. Re: Dynamically adding LoginModules
                jae77

                oh - that's even better :)

                when this method is used, does it completely override any entries that may already be in the login-conf.xml file in the "conf" directory, or does it just append it self to the list?

                • 5. Re: Dynamically adding LoginModules
                  jae77

                  excellent - that's what i wanted to confirm. thx much!