3 Replies Latest reply on Jun 7, 2004 5:02 PM by adrian.brock

    MDB accessing security credentials

    sanjewad

      Hi
      I am using JBo22 3.2.3 and inside my MDB there are other EJBs with security authenticated.
      My question is how Do I pass the user credentials to those EJBs running inside the MDB from client side.
      I am using a queue for this example.
      I tried with JBossMQ Database Configuration but it fails.

        • 1. Re: MDB accessing security credentials

          You need to perform a JAAS login.

          The JBossMQ security domain protects the queues and topic access.

          • 2. Re: MDB accessing security credentials
            sanjewad

            You mean Do I have to do

            String username="test";
            String password = "test";
            System.setProperty("java.security.auth.login.config", "file:/C:/jboss-3.2.3/client/auth.conf");
            SecurityAssociationHandler handler = new SecurityAssociationHandler();
            SimplePrincipal user = new SimplePrincipal(username);
            handler.setSecurityInfo(user, password.toCharArray());
            LoginContext loginContext = new LoginContext("other", (CallbackHandler)handler);
            loginContext.login();
            Subject subject = loginContext.getSubject();
            Set principals = subject.getPrincipals();
            principals.add(user);
            Hashtable hs = new Hashtable();
            hs.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
            hs.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
            hs.put("java.naming.provider.url", "localhost" + ":1099");


            and then look up the queue and send the message?.

            I tried this and it does not seem that EJB inside MDB is getting this credentials.
            Please help me .

            • 3. Re: MDB accessing security credentials

              You problem is with the MDB accessing other ejbs.

              Why do think peforming a login during the send will make any difference?

              Moderated: If you use search you will find the options available to you discussed
              many times.