用户无权创建topic://ActiveMQ.Advisory.Connection

时间:2018-06-05 15:02:07

标签: ldap activemq shiro

我正在尝试在ActiveMQ中实现基于LDAP的身份验证和授权。

LDAP部分使用ApacheDS 2.0完成。 (结构取自http://tmielke.blogspot.com/2011/12/activemq-ldap-based-authentication-and.html - 遗憾的是,引用的FuseSource ActiveMQ安全指南处于脱机状态)

我使用SHA userPassword将用户(例如uid = user2,ou = users,o = X)创建为inetOrgPerson。 ou =系统看起来像这样:

LDAP ActiveMQ structure

所选元素的ldif为:

dn: cn=admin,cn=ActiveMQ.\>,ou=Topic,ou=Destination,ou=ActiveMQ,ou=system
objectClass: groupOfNames
objectClass: top
cn: admin
member: ou=users,o=X
member: uid=user2,ou=users,o=X

(我只尝试了其中一个成员和两个成员)

shiro.ini是从activemq.xml的插件部分引用的:

<bean id="shiroPlugin" class="org.apache.activemq.shiro.ShiroPlugin" xmlns="http://www.springframework.org/schema/beans">
    <property name="iniResourcePath" value="classpath:shiro.ini"/>
</bean>

并且仅包含[main]部分中的以下条目:

ldapRealm = org.apache.shiro.realm.ldap.JndiLdapRealm
ldapRealm.userDnTemplate = uid={0},ou=users,o=X
ldapRealm.contextFactory.url = ldap://localhost:10389
securityManager.realms = $ldapRealm

身份验证正在使用Java:

Factory<SecurityManager> factory = new IniSecurityManagerFactory("classpath:shiro.ini");
SecurityManager securityManager = factory.getInstance();
AuthenticationToken authenticationToken = new UsernamePasswordToken("user2", "password123");
AuthenticationInfo authenticationInfo = securityManager.authenticate(authenticationToken);
System.out.println("authenticationInfo: " + authenticationInfo);
//authenticationInfo: user2

但是,当连接到MoM-Broker并尝试发送消息时,我得到以下异常:

SecurityException: Subject [user2] is not authorized to create destination: topic://ActiveMQ.Advisory.Connection

如何授予此用户创建目标主题的权限? (This相当陈旧的问题没有帮助)

0 个答案:

没有答案