13 Replies Latest reply on Apr 27, 2009 12:21 PM by Karl Traunmüller

    Authentification problems in Jboss 5

    Thomas Gueze Newbie

      I am using Jboss 5 app server and I have some problems when using jaas authentification.

      Different users login and logout successively and call beans methods.
      On the client side, I have a custom login module which perform authentification.
      On the server side, I use the ClientLoginModule.
      In the beans, I retrieve the EJBContext with a lookup and get the caller principal.
      Sometimes it works, but sometimes, the caller returned doesn't correspond to the user who made the login. It corresponds to a user who was logged before and who logout.

      final Object o = new InitialContext().lookup("java:comp/EJBContext");
      final Class< ? > ejbContextClass = Class.forName("javax.ejb.EJBContext");
      final Method getCallerPrincipalMethod = ejbContextClass.getMethod("getCallerPrincipal");
      final Principal principal = (Principal) getCallerPrincipalMethod.invoke(o);
      final String callerId = principal.getName();

      Any idea? Do I forgot something?