问题描述
我试图在activemq中使用授权,但是现在停留了一段时间。
I am trying to use authorization in activemq, but stuck for some time now.
这是我的Java代码,删除授权插件后一切正常。我正在尝试创建一个名为 room2的主题。
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");
这是我的activemq.xml:
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>
这是我得到的错误:
User system is not authorized to create: topic://ActiveMQ.Advisory.Connection
如果我使用< authorizationEntry topic => read = consumers write = publishers admin = admins />
,那么它可以正常工作,因此>
到底能做什么
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.
<authorizationEntry topic="ActiveMQ.Advisory.>" read="guests,users" write="guests,users" admin="guests,users"/>
请参阅文档。
这篇关于activemq用户无权创建:topic://ActiveMQ.Advisory.Connection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!