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 implementation
of the javax.security.auth.spi.LoginModule interface and a configuration change to ActiveMQ. Fortunately, ActiveMQ comes with implementations of some modules that can authenticate users using properties files, LDAP, and SSL certificates, which will be enough for many use cases. Because JAAS login modules follow a specification, one advantage of them is that they’re relatively straightforward to configure. The best way to understand a login module is by walking through a configuration. For this task, the login module that works with properties files will be used.

  The first step in this task is to identify the PropertiesLoginModule so that ActiveMQ is made aware of it. To do so, you must create a file named login.config that contains a standardized format for configuring JAAS users and groups. Here are the contents of the file:

activemq-domain {
org.apache.activemq.jaas.PropertiesLoginModule required
org.apache.activemq.jaas.properties.user="users.properties"
org.apache.activemq.jaas.properties.group="groups.properties";
};

  The login.config file shown here contains a few different items for configuring a JAAS module. The activemq-domain is the predominant item in this file and it contains all the configuration for the login module. First is the fully qualified name of the PropertiesLoginModule and the trailing notation identifying it as required. This means that the authentication can’t continue without this login module. Second is a line to enable debug logging for the login module; this is optional. Third is the org.apache.activemq.jaas.properties.user property, which points to the users.properties file. Fourth is the org.apache.activemq.jaas.properties.group property, which points to the groups.properties file. Once this is all defined, the two properties files must be created.

  NOTE: The PropertiesLoginModule used in this section is an implementation of a JAAS login module, and it comes with ActiveMQ.

  Defining user credentials in the properties files is simple. The users.properties file defines each user in a line-delimited manner along with its password, as shown:

admin=admin
producer=producer
consumer=consumer
guest=guest

  The groups.properties file defines group names in a line-delimited manner as well. But each group contains a comma-separated list of its users as shown:

admins=admin
producers=admin,producer
consumers=admin,producer,consumer
guests=guest

  Once these files are created, the JAAS plug-in must be defined in the ActiveMQ XML configuration file. The following is an example of this necessary change:

...
<plugins>
<jaasAuthenticationPlugin configuration="activemq-domain" />
</plugins>
...

  The example is shortened for readability and only shows the necessary change to enable the JAAS login module. As you can see, the JAAS plug-in only needs the name of the JAAS domain in the login.config file. ActiveMQ will locate the login.config file on the classpath (an alternative to this is to use the java.security.auth.login.config system property for the location of the login.config file). To test out the JAAS login module that was just created, start up ActiveMQ using these changes. Here’s the command to use:

${ACTIVEMQ_HOME}/bin/activemq start -Djava.security.auth.login.config=/home/ucm/activemq/apache-activemq-5.10.2/conf/login.config

You can also set the environment variable:

export ACTIVEMQ_OPTS=-Djava.security.auth.login.config=/home/ucm/activemq/apache-activemq-5.10.2/conf/login.config

  The JAAS plug-in provides exactly the same functionality as the simple authentication plug-in. But it does so using the standardized Java mechanism, meaning you can use it to plug in any existing security policies you use inside your organization.

ActiveMQ(5.10.0) - Configuring the JAAS Authentication Plug-in的更多相关文章

  1. 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 directl ...

  2. ActiveMQ 5.10.0 安装与配置

    先在官网下载activeMQ,我这里是5.10.0. 然后在解压在一个文件夹下即可. 我这里是:D:\apache-activemq-5.10.0-bin 然后进入bin目录:D:\apache-ac ...

  3. ActiveMQ(5.10.0) - Destination-level authorization

    To build upon authentication, consider a use case requiring more fine-grained control over clients t ...

  4. ActiveMQ(5.10.0) - Building a custom security plug-in

    If none of any built-in security mechanisms works for you, you can always build your own. Though the ...

  5. ActiveMQ(5.10.0) - Spring Support

    Maven Dependency: <dependencies> <dependency> <groupId>org.apache.activemq</gro ...

  6. ActiveMQ(5.10.0) - 删除闲置的队列或主题

    方法一 通过 ActiveMQ Web 控制台删除. 方法二 通过 Java 代码删除. ActiveMQConnection.destroyDestination(ActiveMQDestinati ...

  7. ActiveMQ(5.10.0) - Connection Configuration URI

    An Apache ActiveMQ connection can be configured by explicitly setting properties on the ActiveMQConn ...

  8. ActiveMQ(5.10.0) - hello world

    Sending a JMS message public class MyMessageProducer { ... // 创建连接工厂实例 ConnectionFactory connFactory ...

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

    1. 编辑 ACTIVEMQ_HOME/conf/activemq.xml. <beans> <broker brokerName="localhost" per ...

随机推荐

  1. CentOS_6.5 64位系统,安装git服务器+客户端

    ================ git服务器安装 ==================== CentOS安装Git服务器 Centos 6.4 + Git 1.8.2.2 + gitosis## . ...

  2. TypeScript学习笔记(五):接口

    使用接口 在前面的笔记中我们知道可以使用Object Type来指定参数的属性,如下: function printLabel(labelledObj: {label: string}) { cons ...

  3. 改变Oracle数据库连接端口

    Oracle数据库默认数据库监听与连接端口是1521, 但是有时候项目中需要更改默认端口 这样做很多时候客户要求,基于安全考虑. 以Oracle 11g 为例, 更改Listener的端口大致 需要以 ...

  4. shiro安全框架

    原文:http://blog.csdn.net/boonya/article/details/8233303 可能大家早先会见过 J-security,这个是 Shiro 的前身.在 2009 年 3 ...

  5. ADO.NET 快速入门(八):处理 Errors

    除了 Try/Catch 和 Exceptions 以外,新的 ADO.NET 数据框架也允许在 DataSet 的每行数据添加错误信息.如果 Updates 或者其他操作失败,SqlDataAdap ...

  6. 节点文件将两个不同格式的XML文件,进行节点对照,并生成一个用于对照功能的XML

    本文纯属个人见解,是对前面学习的总结,如有描述不正确的地方还请高手指正~ 经常有的需求是,需要将一种格式的XML转换成另一种XML.如果要实现这个功能首先需要将两个不同XML手动建立节点对比关系.然后 ...

  7. phpcms v9和discuz X3.1实现同步登陆退出论坛(已实现)

    网络上文章很多,按步骤配置好了之后phpcms可以同步登录dz,但是dz登录后状态却无法同步到phpcms,网络上找了很多资料都大同小异,头大.只能自己调试了,废话不多说了.       以下网络上抄 ...

  8. delphi TToolBar

    工具栏  的属性 xe4的事件 Customizable OnCustomizeCanDelete OnCustomizeCanInsert OnCustomized OnCustomizeAdded ...

  9. 理解WebKit和Chromium: 调试Android系统上的Chromium

    转载请注明原文地址:http://blog.csdn.net/milado_nju 1. Android上的调试技术 在Android系统上,开发人员能够使用两种不同的语言来开发应用程序,一种是Jav ...

  10. iOS开发——常识swift篇&随机数获取

    随机数获取   arc4random()这个全局函数会生成9位数的随机整数   1,下面是使用arc4random函数求一个1~100的随机数(包括1和100)     var temp:Int = ...