ARTEMIS-2326 remove pwd params before creating protocol mgr

This commit is contained in:
Justin Bertram 2019-04-29 12:42:27 -05:00 committed by Clebert Suconic
parent f664713757
commit f584efd574
7 changed files with 17 additions and 0 deletions

View File

@ -50,6 +50,7 @@ public class ProtonProtocolManagerFactory extends AbstractProtocolManagerFactory
final Map<String, Object> parameters,
List<BaseInterceptor> incomingInterceptors,
List<BaseInterceptor> outgoingInterceptors) throws Exception {
stripPasswordParameters(parameters);
return BeanSupport.setData(new ProtonProtocolManager(this, server, incomingInterceptors, outgoingInterceptors), parameters);
}

View File

@ -49,6 +49,7 @@ public class HornetQProtocolManagerFactory extends CoreProtocolManagerFactory {
hqIncoming.add(new HQPropertiesConversionInterceptor(true));
hqOutgoing.add(new HQPropertiesConversionInterceptor(false));
stripPasswordParameters(parameters);
return BeanSupport.setData(new HornetQProtocolManager(this, server, hqIncoming, hqOutgoing), parameters);
}

View File

@ -46,6 +46,7 @@ public class MQTTProtocolManagerFactory extends AbstractProtocolManagerFactory<M
final Map<String, Object> parameters,
List<BaseInterceptor> incomingInterceptors,
List<BaseInterceptor> outgoingInterceptors) throws Exception {
stripPasswordParameters(parameters);
return BeanSupport.setData(new MQTTProtocolManager(server, connectedClients, sessionStates, incomingInterceptors, outgoingInterceptors), parameters);
}

View File

@ -43,6 +43,7 @@ public class OpenWireProtocolManagerFactory extends AbstractProtocolManagerFacto
Map<String, Object> parameters,
final List<BaseInterceptor> incomingInterceptors,
List<BaseInterceptor> outgoingInterceptors) throws Exception {
stripPasswordParameters(parameters);
return BeanSupport.setData(new OpenWireProtocolManager(this, server), parameters);
}

View File

@ -41,6 +41,7 @@ public class StompProtocolManagerFactory extends AbstractProtocolManagerFactory<
final Map<String, Object> parameters,
final List<BaseInterceptor> incomingInterceptors,
List<BaseInterceptor> outgoingInterceptors) throws Exception {
stripPasswordParameters(parameters);
return BeanSupport.setData(new StompProtocolManager(this, server, filterInterceptors(incomingInterceptors), filterInterceptors(outgoingInterceptors)), parameters);
}

View File

@ -54,6 +54,7 @@ public class CoreProtocolManagerFactory extends AbstractProtocolManagerFactory<I
Map<String, Object> parameters,
final List<BaseInterceptor> incomingInterceptors,
List<BaseInterceptor> outgoingInterceptors) throws Exception {
stripPasswordParameters(parameters);
return BeanSupport.setData(new CoreProtocolManager(this, server, filterInterceptors(incomingInterceptors), filterInterceptors(outgoingInterceptors)), parameters);
}

View File

@ -19,6 +19,7 @@ package org.apache.activemq.artemis.spi.core.protocol;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import org.apache.activemq.artemis.api.core.BaseInterceptor;
@ -47,4 +48,14 @@ public abstract class AbstractProtocolManagerFactory<P extends BaseInterceptor>
return listOut;
}
}
/**
* org.apache.commons.beanutils.BeanUtils will log all the parameters so we strip out any password parameters
* (e.g. passwords for SSL keystore & truststore)
*
* @param parameters
*/
protected void stripPasswordParameters(Map<String, Object> parameters) {
parameters.entrySet().removeIf(entries->entries.getKey().toLowerCase().contains("password"));
}
}