ActiveMQ 权限

ActiveMQ 权限
强烈推介IDEA2020.2破解激活,IntelliJ IDEA 注册码,2020.2 IDEA 激活码

在plugin配置节点下,配置以下信息:

复制代码

            <authorizationPlugin>
                <map>
                    <authorizationMap>
                        <authorizationEntries>
                            <authorizationEntry queue=">" read="admins" write="admins" admin="admins" />
                          <authorizationEntry queue="USERS.>" read="publishers" write="publishers" admin="admins" />
                          <authorizationEntry queue="FirstQueue.>" read="guests" write="consumer" admin="admins" />                      
                          <authorizationEntry queue="TEST.Q" read="guests" write="guests" />
                        </authorizationEntries>
                    </authorizationMap>
                </map>
            </authorizationPlugin>

复制代码

每个authorizationEntry配置都有read、write和admin属性,分别对应读取、写入和管理。read、write和admin的值为在认证中用户对应的groups属性中的值。

authorizationEntry和消息队列的对应关系是通过通配符方式。

例如:<authorizationEntry queue="FirstQueue.>" read="guests" write="consumer" admin="admins" /> 对应以FirstQueue开头的消息队列。

 ===========================

完整的认证和权限的配置如下:

复制代码

    <plugins>
            <simpleAuthenticationPlugin>
                <users>
                
                    <authenticationUser username="admin" password="password"
                    groups="admins,publishers,consumers"/>
                    
                    <authenticationUser username="publisher" password="password"
                    groups="publishers,consumers"/>
                    
                    <authenticationUser username="consumer" password="password"
                    groups="consumers"/>
                    
                    <authenticationUser username="guest" password="password"
                    groups="guests"/>
                </users>
            </simpleAuthenticationPlugin>
            
            <authorizationPlugin>
                <map>
                    <authorizationMap>
                        <authorizationEntries>
                            <authorizationEntry queue=">" read="admins" write="admins" admin="admins" />
                          <authorizationEntry queue="USERS.>" read="publishers" write="publishers" admin="admins" />
                          <authorizationEntry queue="FirstQueue.>" read="guests" write="consumer" admin="admins" />                      
                          <authorizationEntry queue="TEST.Q" read="guests" write="guests" />
                        </authorizationEntries>
                    </authorizationMap>
                </map>
            </authorizationPlugin>            
            
            
        </plugins>    

复制代码

本文来源huayang183,由架构君转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/18541

发表评论