Question

Our application relies on an AuthorizationModule for filtering certain IP addresses in a remoting context. This module worked perfectly on JBoss 5.1.0.GA (with a known workaround), but failes on EAP-6.1.0.Alpha, since the Thread name pattern has changed significantly.

Q: Is it possible to obtain the client IP address in the following context?

import org.jboss.security.authorization.modules.AbstractAuthorizationModule;

public class MyAuthorizationModule extends AbstractAuthorizationModule {
  @Override
  public int authorize(Resource resource) {
        //Caller is a standalone Java client, that connects to JBoss 7.x using EJB Remoting
        String callerIP = ...; 
  }
}

What I've tried so far:

  1. Calling java.rmi.server.RemoteServer.getClientHost(). This results in ServerNotActiveException.

  2. Parsing JBossThread name (related discussions).

Was it helpful?

Solution

I solved my problem with some help from the JBoss Community. However, this isn't an elegant solution, since I ended up patching the internals of the application server (EJB3 module). Check out the community post for more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top