Search in sources :

Example 1 with JmxSecretAuthenticator

use of org.apache.synapse.commons.jmx.JmxSecretAuthenticator in project wso2-synapse by wso2.

the class JmxAdapter method createContextMap.

/**
 * Creates an environment context map containing the configuration used to start the
 * server connector.
 *
 * @return an environment context map containing the configuration used to start the server
 *         connector
 */
private Map<String, Object> createContextMap() {
    Map<String, Object> env = new HashMap<String, Object>();
    if (jmxInformation.isAuthenticate()) {
        if (jmxInformation.getRemotePasswordFile() != null) {
            env.put("jmx.remote.x.password.file", jmxInformation.getRemotePasswordFile());
        } else {
            SecretInformation secretInformation = jmxInformation.getSecretInformation();
            // Get the global secret resolver
            // TODO This should be properly implemented if JMX adapter is going to use out side synapse
            PasswordManager pwManager = PasswordManager.getInstance();
            if (pwManager.isInitialized()) {
                secretInformation.setGlobalSecretResolver(pwManager.getSecretResolver());
            }
            env.put(JMXConnectorServer.AUTHENTICATOR, new JmxSecretAuthenticator(jmxInformation.getSecretInformation()));
        }
        if (jmxInformation.getRemoteAccessFile() != null) {
            env.put("jmx.remote.x.access.file", jmxInformation.getRemoteAccessFile());
        }
    } else {
        log.warn("Using unsecured JMX remote access!");
    }
    if (jmxInformation.isRemoteSSL()) {
        log.info("Activated SSL communication");
        env.put("jmx.remote.rmi.client.socket.factory", new SslRMIClientSocketFactory());
        env.put("jmx.remote.rmi.server.socket.factory", new SslRMIServerSocketFactory());
    }
    return env;
}
Also used : SslRMIClientSocketFactory(javax.rmi.ssl.SslRMIClientSocketFactory) SecretInformation(org.wso2.securevault.secret.SecretInformation) HashMap(java.util.HashMap) PasswordManager(org.wso2.securevault.PasswordManager) JmxSecretAuthenticator(org.apache.synapse.commons.jmx.JmxSecretAuthenticator) SslRMIServerSocketFactory(javax.rmi.ssl.SslRMIServerSocketFactory)

Aggregations

HashMap (java.util.HashMap)1 SslRMIClientSocketFactory (javax.rmi.ssl.SslRMIClientSocketFactory)1 SslRMIServerSocketFactory (javax.rmi.ssl.SslRMIServerSocketFactory)1 JmxSecretAuthenticator (org.apache.synapse.commons.jmx.JmxSecretAuthenticator)1 PasswordManager (org.wso2.securevault.PasswordManager)1 SecretInformation (org.wso2.securevault.secret.SecretInformation)1