2 Replies Latest reply on Nov 27, 2001 11:47 AM by patrickvankann

    JAAS examples don't work in JBoss2.4.3-Catalina

    patrickvankann

      Hi, I have seen many posts to this effect but no resolution. Has anyone solved this? Details below.

      I have built and deployed example1.ear from the example source. Everything seems fine, no errors on deployment or startup. However Catalina fails to try and authenticate when you access the http://localhost:8080/restricted/SecuredServlet. It simple shows a 403. The console tells me

      [Default] Bad password for username=null

      In the example, the jboss/conf/catalina/auth.conf for example 1 is

      example1 {
      org.jboss.security.auth.spi.UsersRolesLoginModule required
      ;

      };

      and my jboss.jcml in jboss/conf/catalina/
      <!-- JAAS security manager and realm mapping -->

      org.jboss.security.plugins.JaasSecurityManager
      org.jboss.security.SubjectSecurityProxyFactory


      Otherwise, I build the code exactly as is and followed the instructions.

      This is what occurs at startup.... all looks very normal and healthy.

      [AutoDeployer] Auto deploy of file:/C:/jboss/deploy/tutorial1.ear
      [J2EE Deployer Default] Deploy J2EE application: file:/C:/jboss/deploy/tutorial1
      .ear
      [J2eeDeployer] Create application tutorial1.ear
      [J2eeDeployer] inflate and install WEB module tutorial1.war
      [J2eeDeployer] install EJB module ssbean1.jar
      [J2eeDeployer] add all ejb jar files to the common classpath
      [Container factory] Deploying:file:/C:/jboss/tmp/deploy/Default/tutorial1.ear
      [Verifier] Verifying file:/C:/jboss/tmp/deploy/Default/tutorial1.ear/ejb1005.jar

      [Container factory] Deploying StatelessSession
      [Default] lookup securityDomain manager name: java:/jaas/example1
      [JaasSecurityManagerService] Created securityMgr=org.jboss.security.plugins.Jaas
      SecurityManager@759d12
      [JaasSecurityManagerService] setCachePolicy, c=null
      [JaasSecurityManagerService] Added example1, org.jboss.security.plugins.JaasSecu
      rityManager@759d12 to map
      [Container factory] Deploying StatefulSession
      [Default] lookup securityDomain manager name: java:/jaas/example1
      [Bean Cache] Cache policy scheduler started
      [ContainerManagement] Initializing
      [ContainerManagement] Initialized
      [ContainerManagement] Starting
      [ContainerManagement] Started
      [ContainerManagement] Initializing
      [ContainerManagement] Initialized
      [ContainerManagement] Starting
      [ContainerManagement] Started
      [Container factory] Deployed application: file:/C:/jboss/tmp/deploy/Default/tuto
      rial1.ear
      [J2EE Deployer Default] Starting module tutorial1.war
      [EmbeddedCatalinaServiceSX] deploy, ctxPath=/jaas-example1, warUrl=file:/C:/jbos
      s/tmp/deploy/Default/tutorial1.ear/web1004/
      [EmbeddedCatalinaServiceSX] WebappLoader[/jaas-example1]: Deploying class reposi
      tories to work directory C:\catalina\work\localhost\jaas-example1
      [EmbeddedCatalinaServiceSX] StandardManager[/jaas-example1]: Seeding random numb
      er generator class java.security.SecureRandom
      [EmbeddedCatalinaServiceSX] StandardManager[/jaas-example1]: Seeding of random n
      umber generator has been completed
      [EmbeddedCatalinaServiceSX] ContextConfig[/jaas-example1]: Added certificates ->
      request attribute Valve
      [EmbeddedCatalinaServiceSX] ContextConfig[/jaas-example1]: Configured an authent
      icator for method BASIC
      [EmbeddedCatalinaServiceSX] StandardWrapper[/jaas-example1:default]: Loading con
      tainer servlet default
      [EmbeddedCatalinaServiceSX] default: init
      [EmbeddedCatalinaServiceSX] StandardWrapper[/jaas-example1:invoker]: Loading con
      tainer servlet invoker
      [EmbeddedCatalinaServiceSX] invoker: init
      [EmbeddedCatalinaServiceSX] StandardWrapper[/jaas-example1:jsp]: Using Jasper cl
      assloader for servlet jsp
      [EmbeddedCatalinaServiceSX] jsp: init
      [J2EE Deployer Default] J2EE application: file:/C:/jboss/deploy/tutorial1.ear is
      deployed.

        • 1. Re: JAAS examples don't work in JBoss2.4.3-Catalina
          rajesh_sp

          Hello,
          I think ur problem is you are not able to send the
          principals and credentials to the app server.

          Try this out, Put this code just before the place where you are looking for ejb beans in the client.

          try
          {
          System.setProperty("java.security.auth.login.config", "file://path to the file auth.conf/auth.conf");//This file is in ../jboss-*/client/auth.conf
          // args[0]and args[1] are user name and pass words as strings
          char[] pwd = args[1].toCharArray();
          AppCallbackHandler handler = new AppCallbackHandler(args[0], pwd);//This class shold be in classpath
          System.out.println("Creating LoginContext");
          lc = new LoginContext("Client", handler);
          System.out.println("Created LoginContext");
          lc.login();
          }
          catch (LoginException le)
          {
          System.out.println("Login failed");
          le.printStackTrace();
          }

          and in ../jboss*/client/auth.conf

          put this

          Client {
          org.jboss.security.ClientLoginModule required;
          };

          I think this will work for you
          Rajesh

          • 2. Re: JAAS examples don't work in JBoss2.4.3-Catalina
            patrickvankann

            Hi Rajesh,
            Thanks for your response, but I don't think this is the right solution. My "Client" is a servlet in Catalina. It should automatically provide a "BASIC" style authentication when required.

            It seems that this is a bug in the JBoss2.4.3-Catalina binary distribution that was not present in the JBoss2.4.1-Tomcat3.2.3 distribution.

            Has this bug been fixed in a recent CVS version?

            Patrick