1 Reply Latest reply on Nov 2, 2002 3:18 AM by jcowgar

    Not Authenticating.

    jcowgar

      Greetings. I followed the PDF book and am having problems with user authentication. Obviously I have missed something but cannot figure out what.

      I get the login context, it states (via System.out's I added to the callback) that it's getting the username and password. I then try to call a ejb and get:

      =======================================================

      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.ServerException: EJBException:; nested exception is:
      javax.ejb.EJBException: checkSecurityAssociation; CausedByException is:
      Authentication exception, principal=luke
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:129)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
      at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:198)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy0.create(Unknown Source)
      at com.eldoserv.test.TestJ2eeConnectivity.run(TestJ2eeConnectivity.java:80)
      at com.eldoserv.test.TestJ2eeConnectivity.main(TestJ2eeConnectivity.java:112)
      Caused by: java.rmi.ServerException: EJBException:; nested exception is:
      javax.ejb.EJBException: checkSecurityAssociation; CausedByException is:
      Authentication exception, principal=luke
      at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:355)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:133)
      at org.jboss.ejb.StatelessSessionContainer.invokeHome(StatelessSessionContainer.java:300)
      at org.jboss.ejb.Container.invoke(Container.java:730)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:381)
      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:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)
      Caused by: javax.ejb.EJBException: checkSecurityAssociation; CausedByException is:
      Authentication exception, principal=luke
      at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(SecurityInterceptor.java:174)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:94)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
      ... 15 more

      =======================================================

      I added the user luke to my users.properties file and to the roles.properties file as having user,admin as the two roles. My EJB's do not yet require any auth, but I set JBoss up to require Auth.

      =======================================================

      My client auth.conf file looks like:

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

      =======================================================

      and my server login-config.xml looks like:


      <!-- Security config for the KnoPRO application. -->
      <application-policy name="KnoPRO">

      <login-module flag="required" code="org.jboss.security.auth.spi.UsersRolesLoginModule">
      </login-module>

      </application-policy>


      =======================================================

      and my login context:

      lc = new LoginContext("KnoPRO", cbh);

      =======================================================

      my users.properties:

      luke=lucas

      =======================================================

      my roles.properties:

      luke=user,admin

      =======================================================

      my callback class:

      private class UserCodePasswordHandler implements CallbackHandler {
      public void handle(Callback[] callbacks)
      throws IOException, UnsupportedCallbackException
      {
      for (int i=0; i < callbacks.length; i++) {
      if (callbacks instanceof NameCallback) {
      NameCallback nc = (NameCallback)callbacks
      ;
      nc.setName("luke");
      } else if (callbacks instanceof PasswordCallback) {
      PasswordCallback pc = (PasswordCallback)callbacks
      ;
      pc.setPassword("lucas".toCharArray());
      } else {
      System.out.println("Unknown callback");
      throw new UnsupportedCallbackException(callbacks, "Unknown callback");
      }
      }
      }
      };

      Thank you for any help,

      Jeremy Cowgar
      jc@cowgar.com