5 Replies Latest reply on Jul 17, 2014 1:32 PM by ministro_mayor

    Extend LdapExtLoginModule Java class

    upendrasaikumar

      I have Extended the LdapExtLoginModule class and packed my new class as a jar file and placed in the JBOSS_HOME/lib along with the JBOSSX.jar where the LdapExtLoginModule class is available.

      This is how my authentication look like before i extended the LdapExtLoginModule java class

       

      <application-policy xmlns="urn:jboss:security-beans:1.0" name="Sonora">
        
      <authentication>
        
      <login-module code="**org.jboss.security.auth.spi.LdapExtLoginModule**" flag="required">
        
      <module-option name="unauthenticatedIdentity">SONORA</module-option>
        
      <module-option name="java.naming.provider.url">ldap://AD-Corp-Primary.xxx.com:389 ldap://AD-Corp-Secondary.xxx.com:389/</module-option>
        
      <module-option name="java.naming.security.authentication">simple</module-option>
        
      <module-option name="bindDN">CN=C360LDAP,OU=System Accounts,OU=Users and Groups,DC=corporate,DC=xxx,DC=com</module-option>
        
      <module-option name="bindCredential">xyz</module-option>
        
      <module-option name="jaasSecurityDomain">jboss.security:service=JaasSecurityDomain,domain=LdapPassword</module-option>
        
      <module-option name="baseCtxDN">dc=corporateltcg=xxx,dc=com</module-option>
        
      <module-option name="baseFilter">(sAMAccountName={0})</module-option>
        
      <module-option name="rolesCtxDN">ou=Resources,ou=Users and Groups,dc=corporate,dc=ltcg,dc=com</module-option>
        
      <module-option name="roleFilter">(member={1})</module-option>
        
      <module-option name="roleAttributeID">memberOf</module-option>
        
      <module-option name="roleAttributeIsDN">true</module-option>
        
      <module-option name="roleRecursion">1</module-option>
        
      <module-option name="searchScope">SUBTREE_SCOPE</module-option>
        
      <module-option name="searchTimeLimit">30000</module-option>
        
      <module-option name="defaultRole">HttpInvoker</module-option>
        
      <module-option name="allowEmptyPasswords">false</module-option>
        
      <module-option name="useObjectCredential">true</module-option>

        
      </login-module>
        
      </authentication>
        
      </application-policy>


      Now i have replaced with CustomeLdapAuthentication.java which i have extended, the configuration looks like below


      <application-policy xmlns="urn:jboss:security-beans:1.0" name="Sonora">
        
      <authentication>
        
      <login-module code="**com.xxx.security.ldap.case.CustomeLdapAuthentication**" flag="required">
        
      <module-option name="unauthenticatedIdentity">SONORA</module-option>
        
      <module-option name="java.naming.provider.url">ldap://AD-Corp-Primary.xxx.com:389 ldap://AD-Corp-Secondary.xxx.com:389/</module-option>
        
      <module-option name="java.naming.security.authentication">simple</module-option>
        
      <module-option name="bindDN">CN=C360LDAP,OU=System Accounts,OU=Users and Groups,DC=corporate,DC=xxx,DC=com</module-option>
        
      <module-option name="bindCredential">xyz</module-option>
        
      <module-option name="jaasSecurityDomain">jboss.security:service=JaasSecurityDomain,domain=LdapPassword</module-option>
        
      <module-option name="baseCtxDN">dc=corporateltcg=xxx,dc=com</module-option>
        
      <module-option name="baseFilter">(sAMAccountName={0})</module-option>
        
      <module-option name="rolesCtxDN">ou=Resources,ou=Users and Groups,dc=corporate,dc=ltcg,dc=com</module-option>
        
      <module-option name="roleFilter">(member={1})</module-option>
        
      <module-option name="roleAttributeID">memberOf</module-option>
        
      <module-option name="roleAttributeIsDN">true</module-option>
        
      <module-option name="roleRecursion">1</module-option>
        
      <module-option name="searchScope">SUBTREE_SCOPE</module-option>
        
      <module-option name="searchTimeLimit">30000</module-option>
        
      <module-option name="defaultRole">HttpInvoker</module-option>
        
      <module-option name="allowEmptyPasswords">false</module-option>
        
      <module-option name="useObjectCredential">true</module-option>

        
      </login-module>
        
      </authentication>
        
      </application-policy>


      The result is an exception as below



      ERROR [SecurityInterceptor] Error in Security Interceptor: java.lang.SecurityException: Authentication exception, principal=null
        at org
      .jboss.ejb.plugins.SecurityInterceptor.checkSecurityContext(SecurityInterceptor.java:322) [:6.0.0.Final]
        at org
      .jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:243) [:6.0.0.Final]
        at org
      .jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:205) [:6.0.0.Final]
        at org
      .jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:142) [:6.0.0.Final]
        at org
      .jboss.ejb.plugins.security.PreSecurityInterceptor.invokeHome(PreSecurityInterceptor.java:88) [:6.0.0.Final]
        at org
      .jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132) [:6.0.0.Final]
        at org
      .jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107) [:6.0.0.Final]
        at org
      .jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:639) [:6.0.0.Final]
        at org
      .jboss.ejb.Container.invoke(Container.java:1089) [:6.0.0.Final]
        at sun
      .reflect.GeneratedMethodAccessor433.invoke(Unknown Source) [:1.6.0_43]
        at sun
      .reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_43]
        at java
      .lang.reflect.Method.invoke(Method.java:597) [:1.6.0_43]
        at org
      .jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) [:6.0.0.GA]
        at org
      .jboss.mx.server.Invocation.dispatch(Invocation.java:96) [:6.0.0.GA]
        at org
      .jboss.mx.server.Invocation.invoke(Invocation.java:88) [:6.0.0.GA]
        at org
      .jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271) [:6.0.0.GA]
        at org
      .jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670) [:6.0.0.GA]
        at org
      .jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169) [:6.0.0.Final]
        at org
      .jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118) [:6.0.0.Final]
        at org
      .jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209) [:6.0.0.Final]
        at org
      .jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195) [:6.0.0.Final]
        at org
      .jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61) [:6.0.0.Final]
        at org
      .jboss.proxy.ejb.SecurityContextInterceptor.invoke(SecurityContextInterceptor.java:64) [:6.0.0.Final]
        at org
      .jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:68) [:6.0.0.Final]
        at org
      .jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:184) [:6.0.0.Final]
        at org
      .jboss.proxy.ClientContainer.invoke(ClientContainer.java:101) [:6.0.0.Final]
        at com
      .sun.proxy.$Proxy334.create(Unknown Source)
        at com
      .eistream.sonora.system.SystemApplicationProperties.getValue(SystemApplicationProperties.java:170) [:]
        at com
      .eistream.sonora.util.LogCaseManagerPropFactory.getString(LogCaseManagerPropFactory.java:21) [:]
        at com
      .eistream.utilities.logcategory.ConfigLog.init(ConfigLog.java:161) [:1.0.0.0377]
        at com
      .eistream.sonora.cachemanager.CacheManagerServlet.init(CacheManagerServlet.java:36)
        at org
      .apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1208) [:6.0.0.Final]
        at org
      .apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1108) [:6.0.0.Final]
        at org
      .apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3628) [:6.0.0.Final]
        at org
      .apache.catalina.core.StandardContext.start(StandardContext.java:3851) [:6.0.0.Final]
        at org
      .jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:294) [:6.0.0.Final]
        at org
      .jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:146) [:6.0.0.Final]
        at org
      .jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:477) [:6.0.0.Final]
        at org
      .jboss.web.deployers.WebModule.startModule(WebModule.java:118) [:6.0.0.Final]
        at org
      .jboss.web.deployers.WebModule.start(WebModule.java:95) [:6.0.0.Final]
        at sun
      .reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_43]
        at sun
      .reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_43]
        at sun
      .reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_43]
        at java
      .lang.reflect.Method.invoke(Method.java:597) [:1.6.0_43]
        at org
      .jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) [:6.0.0.GA]
        at org
      .jboss.mx.server.Invocation.dispatch(Invocation.java:96) [:6.0.0.GA]
        at org
      .jboss.mx.server.Invocation.invoke(Invocation.java:88) [:6.0.0.GA]
        at org
      .jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271) [:6.0.0.GA]
        at org
      .jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670) [:6.0.0.GA]
        at org
      .jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206) [:2.2.0.GA]
        at com
      .sun.proxy.$Proxy41.start(Unknown Source)
        at org
      .jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:53) [:2.2.0.GA]
        at org
      .jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:41) [:2.2.0.GA]
        at org
      .jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:301) [:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.install(AbstractController.java:894) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.install(AbstractController.java:641) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:182) [:2.2.0.GA]
        at org
      .jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:58) [:2.2.0.GA]
        at org
      .jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) [:2.2.0.GA]
        at org
      .jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) [:2.2.0.GA]
        at org
      .jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.0.GA]
        at org
      .jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.0.GA]
        at org
      .jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.0.GA]
        at org
      .jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1571) [:2.2.0.GA]
        at org
      .jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1603) [:2.2.0.GA]
        at org
      .jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983) [:2.2.0.GA]
        at org
      .jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076) [:2.2.0.GA]
        at org
      .jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) [:2.2.0.GA]
        at org
      .jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) [:6.0.0.Final]
        at org
      .jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:143) [:0.2.2]
        at org
      .jboss.profileservice.dependency.ProfileDeployAction.deploy(ProfileDeployAction.java:151) [:0.2.2]
        at org
      .jboss.profileservice.dependency.ProfileDeployAction.installActionInternal(ProfileDeployAction.java:94) [:0.2.2]
        at org
      .jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.GA]
        at org
      .jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]
        at org
      .jboss.profileservice.dependency.ProfileActivationWrapper$BasicProfileActivation.start(ProfileActivationWrapper.java:190) [:0.2.2]
        at org
      .jboss.profileservice.dependency.ProfileActivationWrapper.start(ProfileActivationWrapper.java:87) [:0.2.2]
        at org
      .jboss.profileservice.dependency.ProfileActivationService.activateProfile(ProfileActivationService.java:215) [:0.2.2]
        at org
      .jboss.profileservice.dependency.ProfileActivationService.activate(ProfileActivationService.java:159) [:0.2.2]
        at org
      .jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.activate(AbstractProfileServiceBootstrap.java:112) [:0.2.2]
        at org
      .jboss.profileservice.resolver.BasicResolverFactory$ProfileResolverFacade.deploy(BasicResolverFactory.java:87) [:0.2.2]
        at org
      .jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.start(AbstractProfileServiceBootstrap.java:91) [:0.2.2]
        at org
      .jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:132) [:6.0.0.Final]
        at org
      .jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]
        at org
      .jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
        at org
      .jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
        at java
      .lang.Thread.run(Thread.java:662) [:1.6.0_43]


      Please help me how this is happening, once if i replace the it with the original, this was not happening and this was happening at bool level itself, the log i have pasted is from boot.log

      thanks! in advance

      @upendra.S


        • 1. Re: Extend LdapExtLoginModule Java class
          ministro_mayor

          You shure you are setting appropriately the Principal implementation within Security Context?

           

          ERROR [SecurityInterceptor] Error in Security Interceptor: java.lang.SecurityException: Authentication exception,principal=null

           

          This could mean that the principal (the object which is an abstraction of User and Groups/Roles) is equals to null. so, no user logged-in for JAAS.

           

          Greetings.

          • 2. Re: Extend LdapExtLoginModule Java class
            upendrasaikumar

            Hi Edgar Lazaro,

            Thanks for the reply.

            My Implementation class does nothing other than calling the super class methods in the overridden methods, before calling super class method i just had a out.print statement.

            I have placed my implementation class also in the lib directory by making as a jar file.

             

            Thanks!

            Upendra.S

            • 3. Re: Extend LdapExtLoginModule Java class
              ministro_mayor

              Which JBoss Versión are you using? can you share your implementation code? I override once a LdapExtLoginModule for JBoss 5.0.1 but I take the entire original implementación, made the necessary changes and redeploy as an endorsed library.

              • 4. Re: Extend LdapExtLoginModule Java class
                upendrasaikumar

                Hi Edgar Lazaro,

                 

                The Jboss version which i am using was JBoss-6.0.0.Final and the implementation is as below

                 

                package com.security.ldap.case360;

                 

                import java.security.Principal;

                import java.security.acl.Group;

                import java.util.Map;

                import java.util.Set;

                 

                import javax.naming.NamingException;

                import javax.naming.directory.SearchControls;

                import javax.naming.ldap.InitialLdapContext;

                import javax.security.auth.Subject;

                import javax.security.auth.callback.CallbackHandler;

                import javax.security.auth.login.LoginException;

                 

                import org.jboss.security.auth.spi.LdapExtLoginModule;

                 

                public class Case360LdapAuthentication extends LdapExtLoginModule{

                 

                    @Override

                    protected String bindDNAuthentication(InitialLdapContext arg0, String arg1,

                            Object arg2, String arg3, String arg4) throws NamingException {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : bindDNAuthentication method() :"+arg0+" : "+arg1+" : "+arg2+" : "+arg3+" : "+arg4);

                        return super.bindDNAuthentication(arg0, arg1, arg2, arg3, arg4);

                    }

                   

                    @Override

                    protected Group createGroup(String arg0, Set<Principal> arg1) {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : createGroup method() :"+ arg0+" : "+arg1);

                        return super.createGroup(arg0, arg1);

                    }

                   

                    @Override

                    protected Principal createIdentity(String arg0) throws Exception {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : createIdentity method() :"+ arg0);

                        return super.createIdentity(arg0);

                    }

                   

                    @Override

                    protected String createPasswordHash(String arg0, String arg1, String arg2)

                            throws LoginException {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : createIdentity method() :"+ arg0);

                        return super.createPasswordHash(arg0, arg1, arg2);

                    }

                   

                    @Override

                    protected Object getCredentials() {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : getCredentials method() :");

                        return super.getCredentials();

                    }

                   

                    @Override

                    protected Principal getIdentity() {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : getIdentity method() :");

                        return super.getIdentity();

                    }

                   

                    @Override

                    protected Group[] getRoleSets() throws LoginException {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : getRoleSets method() :");

                        return super.getRoleSets();

                    }

                   

                    @Override

                    protected Principal getUnauthenticatedIdentity() {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : getUnauthenticatedIdentity method() :");

                        return super.getUnauthenticatedIdentity();

                    }

                   

                    @Override

                    protected boolean getUseFirstPass() {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : getUseFirstPass method() :");

                        return super.getUseFirstPass();

                    }

                   

                    @Override

                    protected String getUsername() {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : getUsername method() :");

                        return super.getUsername();

                    }

                   

                    @Override

                    protected String[] getUsernameAndPassword() throws LoginException {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : getUsernameAndPassword method() :");

                        return super.getUsernameAndPassword();

                    }

                   

                    @Override

                    protected String getUsersPassword() throws LoginException {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : getUsersPassword method() :");

                        return super.getUsersPassword();

                    }

                   

                    @Override

                    protected Throwable getValidateError() {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : getValidateError method() :");

                        return super.getValidateError();

                    }

                   

                    @Override

                    public void initialize(Subject subject, CallbackHandler callbackHandler,

                            Map sharedState, Map options) {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : initialize method() :"+subject+" : "+callbackHandler+ " : "+sharedState+" : "+options);

                        super.initialize(subject, callbackHandler, sharedState, options);

                    }

                   

                    @Override

                    public boolean checkIgnoreMatches(String arg0, String[] arg1) {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : createIdentity method() :"+ arg0);

                        return super.checkIgnoreMatches(arg0, arg1);

                    }

                   

                    @Override

                    public boolean login() throws LoginException {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : login method() :");

                        return super.login();

                    }

                   

                    @Override

                    public boolean logout() throws LoginException {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : logout method() :");

                        return super.logout();

                    }

                   

                    @Override

                    protected void rolesSearch(InitialLdapContext arg0, SearchControls arg1,

                            String arg2, String arg3, int arg4, int arg5)

                            throws NamingException {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : rolesSearch method() :"+arg0+" : "+arg1+" : "+arg2+" : "+arg3+" : "+arg4+" : "+ arg5);

                        super.rolesSearch(arg0, arg1, arg2, arg3, arg4, arg5);

                    }

                   

                    @Override

                    protected void setValidateError(Throwable validateError) {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : setValidateError method() :"+ validateError);

                        super.setValidateError(validateError);

                    }

                   

                    @Override

                    protected boolean validatePassword(String arg0, String arg1) {

                        // TODO Auto-generated method stub

                        System.out.println("Upendra Authentication : validatePassword method() :"+ arg0+" : "+arg1);

                        return super.validatePassword(arg0, arg1);

                    }

                }




                Please let me know if you need any further information.


                Thanks!

                Upendra.S

                • 5. Re: Extend LdapExtLoginModule Java class
                  ministro_mayor

                  I'll try to reproduce the behavior you report,

                   

                  But, meanwhile, you should try to copy the entire "LdapExtLoginModule.java" source code, modify it according your desired functionality, rename class or package or both if you wish and put your resulting jar within endorsed library, then configure as usual on your login-config.xml. Remember to set the security-domain jndi name on you jboss-web.xml file.

                   

                  You can use twiddle (hopefully) to retrieve a list of authentication-managers initiated within you running JBoss instance.

                   

                  Greetings.