代码之家  ›  专栏  ›  技术社区  ›  Burkhard

用户无权创建topic://activemq.advisory.connection

  •  2
  • Burkhard  · 技术社区  · 6 年前

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

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

    我用sha用户密码将用户(例如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
    

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

    从activemq.xml的插件部分引用shiro.ini,其中:

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

    仅包含[主要]部分中的以下条目:

    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代理并尝试发送消息时,我收到以下异常:

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

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

    0 回复  |  直到 6 年前