activemq web console的权限配置

activemq的web console是基于jetty实现,其权限管理也是基于jetty. 根据需求,可以给不同的用户赋予不同的权限。jetty的权限管理还算灵活,虽然配起来比较麻烦,可以分别设定某个角色(role)下的用户是否有对某个页面的访问权限。
下面简要介绍一下配置方法,只需要修改/conf 下的 jetty.xml, jetty-realm.properties
1. jetty-realm.properties
  这里面配置了所有用户的用户名,密码和所属角色,按照如下格式:
username: password [,rolename ...]   

2. jetty.xml
首先对每个角色配置一个Constraint 类,其中roles及对应 jetty-realm.properties中的rolename

<bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
        <property name="name" value="BASIC" />
        <property name="roles" value="admin" />
        <property name="authenticate" value="true" />
    </bean>


然后配置securityConstraintMapping, 
    <bean id="securityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMapping">
        <property name="constraint" ref="securityConstraint" />
        <property name="pathSpec" value="/admin/send.jsp/" />
    </bean>
这表示securityConstraint类对应的角色可以访问/admin/send.jsp 页面。
可以使用/* 代表所有 未单独配置的页面
假设我们需要新建一个只读用户,就可以配置两个角色admin和readonly,这两个角色都需要增加/*的ConstraintMapping 条目,然后在admin上额外配置所有涉及写操作的页面,包括/admin/deleteDestination.action/*, /admin/purgeDestination.action/* 等。

最后,在ConstraintSecurityHandler的constraintMappings属性里,把所有的ConstraintMapping都列出来。

<bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
    <property name="constraintMappings">
            <list>
                <ref bean="securityConstraintMapping" />
            </list>
        </property>
 
这样,就实现了activemq web console用户的权限配置。

 

转载于:https://www.cnblogs.com/buptl/p/6520662.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值