ActiveMQ(5.10.0) - Configuring the simple authentication plug-in

The easiest way to secure the broker is through the use of authentication credentials placed directly in the broker’s XML configuration file. Such functionality is provided by the simple authentication plug-in that’s part of ActiveMQ. The following listing provides an example of using this plug-in.

<plugins>
    <simpleAuthenticationPlugin>
        <users>
            <authenticationUser username="admin" password="admin" groups="admins,publishers,consumers"/>
            <authenticationUser username="publisher" password="publisher" groups="publishers,consumers"/>
            <authenticationUser username="consumer" password="consumer" groups="consumers"/>
            <authenticationUser username="guest" password="guest" groups="guests"/>
        </users>
    </simpleAuthenticationPlugin>
</plugins>

By using this simple configuration snippet, four users can now access ActiveMQ. Obviously, for authentication purposes, each user must have a username and a password. Additionally, the groups attribute provides a comma-separated list of groups to which the user belongs. This information is used for authorization purposes, as will be seen shortly.

The preceding exception is expected because a security plug-in is activated but the authentication credentials haven’t yet been defined in the publisher client. To fix this exception, modify the publisher to add a username and password. The following snippet provides an example of this:

private String username = "publisher";
private String password = "publisher";

public Publisher() throws JMSException {
    factory = new ActiveMQConnectionFactory(brokerURL);
    connection = factory.createConnection(username, password);
    connection.start();
    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    producer = session.createProducer(null);
}

As the preceding snippet shows, the only necessary change is to define a username and a password that are then used as parameters to the call to the createConnection()  method.

Unfortunately, with the simple authentication plug-in, passwords are stored (and transferred) as clear text, which impacts the security of the broker. But even plain-text passwords prevent unauthorized clients from interacting with the broker, and in some
environments this is all that’s needed. Additionally, you can consider using the simple authentication plug-in in combination with the SSL transport, which will at least solve the problem of sending plain passwords over the network.

时间: 2024-10-21 01:28:07

ActiveMQ(5.10.0) - Configuring the simple authentication plug-in的相关文章

ActiveMQ(5.10.0) - Configuring the jaas authentication plug-in

JAAS provides pluggable authentication, which means ActiveMQ will use the same authentication API regardless of the technique used to verify user credentials (a text file, a relational database, LDAP, and so on). All that’s required is an implementat

ActiveMQ(5.10.0) - Destination-level authorization

To build upon authentication, consider a use case requiring more fine-grained control over clients to authorize certain tasks. ActiveMQ provides two levels of authorization: operation-level authorization and message-level authorization. These two typ

ActiveMQ(5.10.0) - Connection Configuration URI

An Apache ActiveMQ connection can be configured by explicitly setting properties on the ActiveMQConnection or ActiveMQConnectionFactory objects themselves via the bean properties or using the following URI syntax. Example You set the property called

ActiveMQ(5.10.0) - Message Redelivery and DLQ Handling

When messages expire on the ActiveMQ broker (they exceed their time-to-live, if set) or can’t be redelivered, they’re moved to a dead-letter queue, so they can be consumed or browsed by an administrator at a later point. Messages are redelivered to a

ActiveMQ(5.10.0) - 使用 JDBC 持久化消息

1. 编辑 ACTIVEMQ_HOME/conf/activemq.xml. <beans> <broker brokerName="localhost" persistent="true" xmlns="http://activemq.apache.org/schema/core"> <persistenceAdapter> <jdbcPersistenceAdapter dataSource=&quo

ActiveMQ(5.10.0) - hello world

Sending a JMS message public class MyMessageProducer { ... // 创建连接工厂实例 ConnectionFactory connFactory = new ActiveMQConnectionFactory( ActiveMQConnection.DEFAULT_USER, ActiveMQConnection.DEFAULT_PASSWORD, "tcp://localhost:61616"); Connection conn

GreenPlum 5.10.0 集群部署

第1部分 初始化系统配置 1.1 部署环境 序号 ip地址 主机名 内存 系统版本 内核版本 1 192.168.61.61 gpmaster61 16Gb CentOS 7.5.1804 3.10.0-862.9.1.el7.x86_64 2 192.168.61.62 gpsegment62 16Gb CentOS 7.5.1804 3.10.0-862.9.1.el7.x86_64 3 192.168.61.63 gpsegment63 16Gb CentOS 7.5.1804 3.10.

odoo 10.0部署shell 待改进

环境ubuntu16+nginx+python2.7.12+postgresql9.5+odoo 10.0 community #!/bin/bash #author:[email protected] #date:2017-09-06 #description:部署odoo 10.0 shell ubuntu >=14 odoo_options=gevent -c /usr/local/odoo/odoo.config odoo_parent_path=/usr/local odoo_path

错误: 找不到或无法加载主类 Files\apache-activemq-5.10.0\bin\..\conf\login.config

在启动activemq的时候出现错误:“错误: 找不到或无法加载主类 Files\apache-activemq-5.10.0\bin\..\conf\login.config”,之前用activemq的时候没遇到这个问题,这次折腾就遇到了.每一次问题,都是一次收获和成长的机会,哪怕是一点点,没关系,不积跬步无以至千里! 查找login.config,明明路径E:\Program Files\apache-activemq-5.10.0\conf\login.config文件存在. 于是仔细阅读