ActiveMQ基本JAAS身份验证配置

时间:2014-12-19 15:09:46

标签: linux activemq

我正在尝试为ActiveMQ配置简单的JAAS身份验证。我创建了一个名为activemq-jaas.xml的xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
  <broker useJmx="false" persistent="false" xmlns="http://activemq.apache.org/schema/core" populateJMSXUserID="true">
    <plugins>
      <jaasAuthenticationPlugin configuration="activemq-domain" />
    </plugins>
  </broker>
</beans>

其他配置文件是:

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";
};

users.properties

admin=admin
publisher=password
consumer=password
guest=password

groups.properties

admins=admin
publishers=admin,publisher
consumers=admin,publisher,consumer
guests=guest

我在linux终端中使用命令./activemq start启动了ActiveMQ。但我无法使用guest/guest凭据登录,但我可以使用admin/admin登录(在配置JAAS xml之前我也可以登录)。我缺少什么?

2 个答案:

答案 0 :(得分:0)

鉴于提供的信息,您似乎并没有真正告诉ActiveMQ加载您的配置。读取的默认文件是“activemq.xml”,并将您命名为“activemq-jaas.xml”,默认情况下不会将其读入。在这种情况下,您需要告诉脚本您要加载的xbean文件,因此请使用:

bin/activemq start xbean:conf/activemq-jaas.xml

根据需要更改它以指向您所在的位置。

答案 1 :(得分:0)

配置显示为guest = password(即,用户名为guest,其中password为password)。你试过这个吗?