ActiveMQ用户认证
ActiveMQ认证分为两种简单认证与JAAS认证,都是通过插件方式实现,创建链接时需要指定用户名与密码,factory.createConnection("publisher","password");
简单认证配置:
<plugins>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="admin" password="password" groups="admins,publishers,consumers" />
<authenticationUser username="publisher" password="password" groups="publishers,consumers" />
<authenticationUser username="consumer" password="password" groups="consumers" />
<authenticationUser username="guest" password="password" groups="guests" />
</users>
</simpleAuthenticationPlugin>
</plugins>
JAAS认证配置:
<plugins>
<jaasAuthenticationPlugin configuration="activemq-domain" />
</plugins>
Configuration值在login.config文件中定义,activemq通过classpath或者是通过java.security.auth.login.config参数加载login.config文件
login.config内容为:
activemq-domain {
org.apache.activemq.jaas.PropertiesLoginModule required
debug=true
org.apache.activemq.jaas.properties.user="users.properties"
org.apache.activemq.jaas.properties.group="groups.properties";
};
其中PropertiesLoginModule实现了javax.security.auth.spi.LoginModule接口
users.properties文件内容:
admin=password
publisher=password
consumer=password
guest=password
groups.properties文件内容:
admins=admin
publishers=admin,publisher,sslpublisher
consumers=admin,publisher,consumer,sslconsumer
guests=guest
上一篇: Google sites, Google 企业应用套件的新成员!
下一篇: 杀死进程