I am trying to use authorization in activemq, but stuck for some time now.
Here is my java code, everything works fine when I remove the authorization plugin. I am trying to create a topic named "room2".
Context jndiContext = new InitialContext();
ConnectionFactory connectionFactory;
connectionFactory = (ConnectionFactory) jndiContext
.lookup("ConnectionFactory");
connection = connectionFactory.createConnection("system", "manager");
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Topic t = session.createTopic("room2");
Here is my activemq.xml :
<plugins>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="system" password="manager"
groups="admins,publishers,consumers"/>
<authenticationUser username="user" password="password"
groups="admins,users,publishers"/>
<authenticationUser username="guest" password="password" groups="guests"/>
</users>
</simpleAuthenticationPlugin>
<authorizationPlugin>
<map>
<authorizationMap>
<authorizationEntries>
<authorizationEntry topic="room2" read="consumers" write="publishers" admin="admins" />
</authorizationEntries>
</authorizationMap>
</map>
</authorizationPlugin>
</plugins>
This is the error that I get :
User system is not authorized to create: topic://ActiveMQ.Advisory.Connection
If I use <authorizationEntry topic=">" read="consumers" write="publishers" admin="admins" />
, then it works fine, so what exactly does >
mean?
You need to assign roles to allow for the creation of Advisory Topics unless you just disable them. An example from the website is below.
Refer to the documentation here.