8 Replies Latest reply: Feb 14, 2012 3:27 PM by Rory Sambrano RSS

Custom login module issue in JBoss AS 7

Marcos Antonio Novice

Hello, everybody!

 

In JBoss AS 6 a have a custom login module that extends org.jboss.security.auth.spi.UsernamePasswordLoginModule and also in my custom login module I use the class org.jboss.security.SimpleGroup. I was trying to port my old application to JBoss 7 but these classes seem not to exist anymore. So in which package and jar(s) are these classes in JBoss AS 7?

 

Thank you in advance.

 

Marcos

  • 1. Re: Custom login module issue in JBoss AS 7
    Marcos Antonio Novice

    I'm sorry. The full class names are:

     

    org.jboss.security.auth.spi.UsernamePasswordLoginModule
    org.jboss.security.SimpleGroup

     

    So, what has changed in JBoss AS 7 regarding login modules? What class should I extend to create my own login module? I looked for this information and didn't find it anywhere. I think that getting this information is useful not only for me, but for the whole community, as login modules are a very popular feature.

     

    Thank you.

     

    Marcos

     

  • 2. Re: Custom login module issue in JBoss AS 7
    Darran Lofthouse Master

    The jar you are looking for is: -

     

    {jboss.home}/modules/org/picketbox/main/picketbox-4.0.0.Final.jar

  • 3. Re: Custom login module issue in JBoss AS 7
    Marcos Antonio Novice

    Thank you for the answer, Darran!

     

    So, I created a class that extends org.jboss.security.auth.spi.UsernamePasswordLoginModule, and configured it in standalone.xml:

     

    <subsystem xmlns="urn:jboss:domain:security:1.0">

        <security-domains>

            <security-domain name="scdh" cache-type="default">

                <authentication>

                    <login-module code="br.urca.scdh.ejb.seguranca.ModuloLogin" flag="required"/>

                </authentication>

            </security-domain>

        </security-domains>

    </subsystem>

     

    and in jboss-web.xml in my web application:

     

     

    <jboss-web>
        <security-domain>java:/jaas/scdh</security-domain>
    </jboss-web>

     

    but it seems that my login module is not called when I perform the login in my application. The login always fail and none of the debug console messages that I placed in the login module get displayed. Any ideas?

     

    Marcos

  • 4. Re: Custom login module issue in JBoss AS 7
    jaikiran pai Master

    Don't use the jndi name in the security-domain element. Use just the name:

     

    <security-domain>scdh</security-domain>

     

    If that still doesn't work, then enable TRACE level logging of security and see what it shows.

  • 5. Re: Custom login module issue in JBoss AS 7
    Marcos Antonio Novice

    jaikiran pai wrote:

     

    Don't use the jndi name in the security-domain element. Use just the name:

     

    <security-domain>scdh</security-domain>

     

    If that still doesn't work, then enable TRACE level logging of security and see what it shows.

     

    Well, it still hasn't worked. The custom login module is still not called. I'm sorry for the dumb question but could you please show how do I enable the TRACE level logging of security so that I can see what's happening? Seeing what could possibly be happening would help a lot, as there's no error messages showing until now.

     

    Marcos

  • 6. Re: Custom login module issue in JBoss AS 7
    jaikiran pai Master

    Add/change the following to your standalone.xml in the logging subsystem:

     

    <periodic-rotating-file-handler name="FILE">
                    <level name="TRACE"/>
    ...
                </periodic-rotating-file-handler>
    
    <logger category="org.jboss.security">
                    <level name="TRACE"/>
                </logger>
    
    
    <logger category="org.jboss.as.web.security">
                    <level name="TRACE"/>
                </logger>
    
    <logger category="org.apache.catalina">
                    <level name="TRACE"/>
                </logger>
    
  • 7. Re: Custom login module issue in JBoss AS 7
    Marcos Antonio Novice

    With trace enabled I saw the error message. JBoss was saying it couldn't find the login module... in the war file. war file? But my custom login module was in an ejb module, why JBoss was looking for it in the war module? So I placed the login module in the war module, changed the code attribute in login-module to point to the new location and everyting went fine. I think that JBoss was looking for the login module in the war file because my ejb module, for the time being, doesn't has any session bean. It just had the login module, that is a regular jave file. Maybe when I add some session beans to the ejb module, JBoss will be able to find the login module there as well. I'm just thinking the the ejb module didn't get deployed. But maybe I'm wrong.

     

    Thank you all.

     

    Marcos

  • 8. Re: Custom login module issue in JBoss AS 7
    Rory Sambrano Newbie

    Marcos,

     

    Did you find the solution to your problem???