Search in sources :

Example 1 with SimpleAuthenticationPlugin

use of org.apache.activemq.security.SimpleAuthenticationPlugin 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");
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) MemoryPersistenceAdapter(org.apache.activemq.store.memory.MemoryPersistenceAdapter) SimpleAuthenticationPlugin(org.apache.activemq.security.SimpleAuthenticationPlugin) ArrayList(java.util.ArrayList) BrokerPlugin(org.apache.activemq.broker.BrokerPlugin) BrokerService(org.apache.activemq.broker.BrokerService) AuthenticationUser(org.apache.activemq.security.AuthenticationUser) Before(org.junit.Before)

Example 2 with SimpleAuthenticationPlugin

use of org.apache.activemq.security.SimpleAuthenticationPlugin 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;
}
Also used : SimpleAuthenticationPlugin(org.apache.activemq.security.SimpleAuthenticationPlugin) ArrayList(java.util.ArrayList) AuthenticationUser(org.apache.activemq.security.AuthenticationUser)

Example 3 with SimpleAuthenticationPlugin

use of org.apache.activemq.security.SimpleAuthenticationPlugin in project activemq-artemis by apache.

the class ExceptionListenerTest method startBroker.

@Before
public void startBroker() throws Exception {
    brokerService = new BrokerService();
    brokerService.setAdvisorySupport(false);
    brokerService.setUseJmx(false);
    brokerService.setPersistent(false);
    brokerService.setPlugins(new BrokerPlugin[] { new SimpleAuthenticationPlugin(new ArrayList()) });
    brokerUri = brokerService.addConnector("tcp://0.0.0.0:0").getConnectUri();
    brokerService.start();
}
Also used : SimpleAuthenticationPlugin(org.apache.activemq.security.SimpleAuthenticationPlugin) ArrayList(java.util.ArrayList) BrokerService(org.apache.activemq.broker.BrokerService) Before(org.junit.Before)

Example 4 with SimpleAuthenticationPlugin

use of org.apache.activemq.security.SimpleAuthenticationPlugin 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;
}
Also used : SimpleAuthenticationPlugin(org.apache.activemq.security.SimpleAuthenticationPlugin) ArrayList(java.util.ArrayList) AuthenticationUser(org.apache.activemq.security.AuthenticationUser)

Example 5 with SimpleAuthenticationPlugin

use of org.apache.activemq.security.SimpleAuthenticationPlugin 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;
}
Also used : SimpleAuthenticationPlugin(org.apache.activemq.security.SimpleAuthenticationPlugin) BrokerService(org.apache.activemq.broker.BrokerService) AuthenticationUser(org.apache.activemq.security.AuthenticationUser)

Aggregations

SimpleAuthenticationPlugin (org.apache.activemq.security.SimpleAuthenticationPlugin)5 ArrayList (java.util.ArrayList)4 AuthenticationUser (org.apache.activemq.security.AuthenticationUser)4 BrokerService (org.apache.activemq.broker.BrokerService)3 Before (org.junit.Before)2 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)1 BrokerPlugin (org.apache.activemq.broker.BrokerPlugin)1 MemoryPersistenceAdapter (org.apache.activemq.store.memory.MemoryPersistenceAdapter)1