PasswordAuthenticator.java | Class | Implementation of the JMXAuthenticator interface to be used on server side to
secure access to
javax.management.remote.JMXConnectorServer JMXConnectorServer s.
Usage:
JMXAuthenticator authenticator = new PasswordAuthenticator(new File("users.properties"));
Map environment = new HashMap();
environment.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
JMXServiceURL address = new JMXServiceURL("rmi", "localhost", 0);
MBeanServer server = ...;
JMXConnectorServer cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(address, environment, server);
The format of the users.properties file is that of a standard properties
file: <user>=<password> where <password> can be
stored in 2 ways:
- Clear text: the password is written in clear text
- Obfuscated text: the password is obfuscated
The obfuscated form can be obtained running this class as a main class:
java -cp mx4j-remote.jar mx4j.tools.remote.PasswordAuthenticator
and following the instructions printed on the console. |