1 Reply Latest reply on Apr 7, 2006 9:09 AM by Albert Dabrowski

    Security on embeddable ejb3

    Albert Dabrowski Newbie


      I have added this topic to this forum as I cannot find the specific to the Jboss embeddable version.

      I am using alpha 5 version and Security is not supported so far.
      I have managed to deploy server by removing security interceptors from ejb3-interceptors-aop.xml. The problem is that when application uses ContextSession to get Prinicipal then I have got IllegalStateException.

      Is there possibility to inject some mock ContextSession to the specific bean to go around this problem? Or You have got some brillant idea how to do it in different way.

      By the way, I cannot remove Security as I am using the same code in embeddable as well as Jboss AS 4


        • 1. Re: Security on embeddable ejb3
          Albert Dabrowski Newbie

          Bingo, I have found simple solution.

          Just add

           props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory");
           props.put(Context.SECURITY_PRINCIPAL, "username");
           props.put(Context.SECURITY_CREDENTIALS, "password");

          these properties to the InitialContext. Then when configured inital context in embeddable bootstrap version there is no problem with getting principal.

          Hope there is no problem with different context factory, as for embeddable it is recommended to use LocalOnlyContextFactory. So far works ok.