在ActiveMQ Artemis中,当我使用自定义JAAS登录模块使用requisite
或required
标志时,我无法登录Artemis管理控制台(Jolokia,端口8163
)。我在定制JAAS登录模块中具有特殊的业务逻辑,该模块对移动设备进行身份验证。但是同时我想拥有一个管理员用户,该管理员用户可以使用一些用户名/密码甚至不使用密码登录到Artemis管理控制台。为了在Artemis login.config
中同时具有定制登录和访客登录模块,我必须至少将定制JAAS模块的安全性标记保留为sufficient
。我该如何处理这种情况?
Hawtio使用的安全性“领域”是通过hawtio.realm
中设置的etc/artemis.profile
系统属性配置的。例如,这是默认设置:
JAVA_ARGS=" -XX:+PrintClassHistogram -XX:+UseG1GC -Xms512M -Xmx2G -Dhawtio.realm=activemq -Dhawtio.offline=true -Dhawtio.role=amq -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal -Djolokia.policyLocation=${ARTEMIS_INSTANCE_ETC_URI}jolokia-access.xml -Djon.id=amq"
此处hawtio.realm
设置为activemq
,它与默认login.config
中的条目匹配,例如:
activemq {
org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule sufficient
debug=false
reload=true
org.apache.activemq.jaas.properties.user="artemis-users.properties"
org.apache.activemq.jaas.properties.role="artemis-roles.properties";
org.apache.activemq.artemis.spi.core.security.jaas.GuestLoginModule sufficient
debug=false
org.apache.activemq.jaas.guest.user="myUser"
org.apache.activemq.jaas.guest.role="amq";
};
我看不出您无法为Hawtio专门添加新领域/域到login.config
,然后在artemis.profile
中更改配置以引用它的原因。这样,您可以根据需要为Hawtio连接和消息传递连接自定义安全性。
此外,值得注意的是,Artemis最近增加了对每个接受者安全域的支持。您可以在the documentation中阅读有关此内容的更多信息。