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.
Obtaining remote client IP in an AuthorizationModule on JBoss 7
-
13-04-2022 - |
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:
Calling
java.rmi.server.RemoteServer.getClientHost()
. This results inServerNotActiveException
.Parsing
JBossThread
name (related discussions).
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow