Skip to content
Advertisement

ActiveMQ basic JAAS authentication configuration

I am trying to configure simple JAAS authentication for ActiveMQ. I have created a xml called activemq-jaas.xml as:

<?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>

The other configuration files are:

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

I started the ActiveMQ with command ./activemq start in linux terminal. But I cannot login with guest/guest credentials but I can login with admin/admin(which I could before I configured JAAS xml also). What I am missing?

Advertisement

Answer

Given the information provided it looks as though you aren’t actually telling ActiveMQ to load your configuration. The default file read is ‘activemq.xml’ and you named yours ‘activemq-jaas.xml’ which won’t be read in by default. You need to tell the script what xbean file you want loaded in this case so use:

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

Changing it as needed to point to the location where yours is at.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement