1 2 Previous Next 17 Replies Latest reply on Apr 7, 2006 7:22 AM by dhartford Go to original post
      • 15. Re: web-tier to intialcontext remote ejb3 call
        starksm64

        The JndiInitialContext cannot be used for propagation because its a client centric class used to populate security from the InitialContext. If this is what your using that is the problem. The standard NamingContextFactory needs to be used with an override of the PROVIDER_URL.

        • 16. Re: web-tier to intialcontext remote ejb3 call
          dhartford


          env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
          // env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
          
           env.setProperty(Context.PROVIDER_URL,"jnp://localhost:1099");


          still same problem... :-(

          • 17. Re: web-tier to intialcontext remote ejb3 call
            dhartford

            I re-tested just my ejb3-client (from a different VM) to do an RMI call on my secured EJB3. With JndiInitialContextLookup, all security items work as expected, incorrect passwords fail, correct username/passwords based on roles work as expected.

            When I change it from JndiLoginInitialContext to either one of the below:

            // env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory");
            // env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
             env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
            


            I get the following error on the client side:
            Exception in thread "main" javax.ejb.EJBAccessException: Authentication failure
             at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.handleGeneralSecurityException(Ejb3AuthenticationInterceptor.java:46)
             at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:71)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
             at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
             at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
             at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:225)
             at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:104)
             at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
             at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
             at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
             at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
             at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:398)
             at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
            Caused by: javax.security.auth.login.FailedLoginException: Password Incorrect/Password Required
             at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:213)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
             at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
             at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
             at java.security.AccessController.doPrivileged(Native Method)
             at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
             at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
             at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:587)
             at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:521)
             at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:330)
             at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:121)
             at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:67)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
             at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
             at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
             at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:225)
             at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:104)
             at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
             at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
             at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
             at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
             at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:398)
             at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
             at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:190)
             at org.jboss.remoting.Client.invoke(Client.java:525)
             at org.jboss.remoting.Client.invoke(Client.java:488)
             at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
             at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
             at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
             at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
             at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
             at $Proxy0.getAssignableRoles(Unknown Source)
             at ClientTest.main(ClientTest.java:30)
            


            This was tested with both 4.0.4RC1 binary drop and 4.0.4CR2 binary drop.



            1 2 Previous Next