2 Replies Latest reply on Jan 8, 2002 9:26 AM by vktyagi

    Using different credentials from EJB Method

    vktyagi

      Hi,

      I am using JBoss 2.4.3 JAAS with database server login module. It seems to work fine so long as I look up my EJBs from outside the Jboss JVM, but I have to look up a new EJB from within a current EJB method with different credentials. My problem is that it looks up the EJB with the same credentials with which the current method was called, even if I supplied the new credentials in the InitialContext used to lookup. Also I tried to use new callback from here, It works fine till the login call of the LoginContext but still when it comes to lookup of the EJB, it uses the previous principal used for method invocation. Do I need to do something extra for this to work??

      Regards
      Vikas

        • 1. Re: Using different credentials from EJB Method

          Hi,

          Can you explain a bit more what you're trying to do? You say you have to set credentials for accessing JNDI within JBoss. Why is that - or are you talking about delegation of credentials for calls to other EJBs?

          If the latter, I'm pretty sure that you can't do this, or at least that it's not something that the EJB spec would allow even if it doesn't say anything about it explicitly.

          The only mechanism it supplies for defining the principal used by a bean is the "security-identity " element in the deployment descriptor.
          You can either use "run-as" to specify the principal that should be used for delegated calls, or "use-caller-identity" to indicate that the caller's principal should be propagated.

          Luke.

          • 2. Re: Using different credentials from EJB Method
            vktyagi

            Dear Luke
            Thanks for your reply.

            It really helped. Now I have changed the approach and it works how I wanted. Actually I was still using EJB 1.1 specs.

            Thanks
            Vikas