use of org.apache.activemq.security.AuthenticationUser in project beam by apache.
the class JmsIOTest method startBroker.
@Before
public void startBroker() throws Exception {
broker = new BrokerService();
broker.setUseJmx(false);
broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
broker.addConnector(BROKER_URL);
broker.setBrokerName("localhost");
broker.setPopulateJMSXUserID(true);
broker.setUseAuthenticatedPrincipalForJMSXUserID(true);
// enable authentication
List<AuthenticationUser> users = new ArrayList<>();
// username and password to use to connect to the broker.
// This user has users privilege (able to browse, consume, produce, list destinations)
users.add(new AuthenticationUser(USERNAME, PASSWORD, "users"));
SimpleAuthenticationPlugin plugin = new SimpleAuthenticationPlugin(users);
BrokerPlugin[] plugins = new BrokerPlugin[] { plugin };
broker.setPlugins(plugins);
broker.start();
// create JMS connection factory
connectionFactory = new ActiveMQConnectionFactory(BROKER_URL);
connectionFactoryWithSyncAcksAndWithoutPrefetch = new ActiveMQConnectionFactory(BROKER_URL + "?jms.prefetchPolicy.all=0&jms.sendAcksAsync=false");
}
use of org.apache.activemq.security.AuthenticationUser in project vertx-proton by vert-x3.
the class ActiveMQTestBase method configureAuthentication.
// Subclasses can override with their own authentication config
protected BrokerPlugin configureAuthentication() throws Exception {
List<AuthenticationUser> users = new ArrayList<AuthenticationUser>();
users.add(new AuthenticationUser(USERNAME_ADMIN, PASSWORD_ADMIN, "users,admins"));
users.add(new AuthenticationUser(USERNAME_USER, PASSWORD_USER, "users"));
users.add(new AuthenticationUser(USERNAME_GUEST, PASSWORD_GUEST, "guests"));
SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users);
authenticationPlugin.setAnonymousAccessAllowed(isAnonymousAccessAllowed());
return authenticationPlugin;
}
use of org.apache.activemq.security.AuthenticationUser in project activemq-artemis by apache.
the class AMQ4889Test method configureAuthentication.
protected BrokerPlugin configureAuthentication() throws Exception {
List<AuthenticationUser> users = new ArrayList<>();
users.add(new AuthenticationUser(USER, GOOD_USER_PASSWORD, "users"));
SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users);
return authenticationPlugin;
}
use of org.apache.activemq.security.AuthenticationUser in project hazelcast-simulator by hazelcast.
the class Broker method start.
public Broker start() {
LOGGER.info("Starting broker using brokerURL: [" + brokerURL + "]");
try {
broker = new BrokerService();
broker.setPersistent(false);
broker.deleteAllMessages();
broker.setDeleteAllMessagesOnStartup(true);
broker.setUseJmx(false);
broker.getSystemUsage().getTempUsage().setLimit(USAGE_LIMIT);
broker.getSystemUsage().getStoreUsage().setLimit(USAGE_LIMIT);
broker.addConnector(brokerURL);
if (username != null) {
AuthenticationUser user = new AuthenticationUser(username, password, "producers,consumer");
SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin();
authenticationPlugin.setAnonymousAccessAllowed(false);
authenticationPlugin.setUsers(singletonList(user));
broker.setPlugins(new BrokerPlugin[] { authenticationPlugin });
}
broker.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
LOGGER.info("Successfully started broker");
return this;
}
Aggregations