Search code examples
javajmx

Finding the user on a JMX call


I am modifying an existing system with an MbeanServer that registers the beans with the server to allow JMX viewing of data etc. In order to access the JMX web pages a login is required and it is integrated with the SSO system somehow although I have not discovered where yet.

For audit purposes I'm wanting to record the name of the user that was logged into the system when some specific methods were accessed.

Is there any way from within the method that was called to find out what the name of the user that made the request is?


Solution

  • Short answer: No!

    To elaborate on this: from your question, I understand that your application looks basically like this:

    Browser -> WebPage -> Servlet -> MBeanProxy -> MBean -> ApplicationCode

    The connection between MBeanProxy and the MBean itself is secured by the credentials given with the configuration of the JVM (the com.sun.management.jmxremote JVM arguments). And you do not necessarily need a real MBeanProxy, you can do the calls to the remote MBean directly, too.

    But anyway, the respective API does not carry a user name or alike.

    Only the access to the WebPage/Servlet can be logged with a user name (where the Servlet could be a JSP, too).