6 Replies Latest reply on Jan 17, 2013 1:23 AM by petterholmstrom

    Registering JBoss Invocation interceptors on the server side of remote EJBs in AS 7.1

    petterholmstrom

      Hello all,

       

      I'm playing around with custom login modules on JBoss AS 7.1. My setup is the following:

       

      Now, the use case for my custom login module is that the "client server" needs to provide a token to the "server server" upon every EJB-invocation. This token is a serializable java object. I have written an EJBClientInterceptor that attaches the token to the EJBClientInvocationContext by calling the putAttachment method. I have also written a JBoss Invocation interceptor for the server side that retrieves the token and puts it in a ThreadLocal. In addition, there is a custom login module on the server side that fetches the token from the ThreadLocal and validates it.

       

      However, my problem is that I have no idea how to register the server-side interceptor with JBoss. I've looked at the EJB3 module source code and especially the EJBRemoteTransactionPrpoagatingInterceptor for hints on how to do this, but I have not been able to figure it out.

       

      Using a standard EJB interceptor won't work in this case, as the interceptor is invoked after the security checks, which means that the ThreadLocal will not have been populated at the time the login module accesses it to authenticate the user.

       

      Any ideas?

       

      Best regards,

       

      -Petter-