使用 LDAP Active Directory 身份验证的 ActiveMQ Web 控制台

2024-01-17

努力让 ActiveMQ Web 控制台使用 LDAP 并根据 Active Directory 进行身份验证。 启动 MQ 时没有错误,出现用户名/密码登录框提示,但在插入正确的凭据时没有进展。

Version 5.15.6

登录配置

amqLdapLoginModule {
   org.eclipse.jetty.jaas.spi.LdapLoginModule required
   debug="true"
   contextFactory="com.sun.jndi.ldap.LdapCtxFactory"
   hostname="ad-server1.domain.com"
   port="389"
   bindDn="CN=readonly-user,OU=Accounts,DC=domain,DC=com"
   bindPassword="readonly-user-password"
   authenticationMethod="simple"
   forceBindingLogin="false"
   userBaseDn="CN=users,DC=domain,DC=com"
   userRdnAttribute="uid"
   userIdAttribute="uid"
   userPasswordAttribute="userPassword"
   userObjectClass="inetOrgPerson"
   roleBaseDn="CN=groups,DC=domain,dc=com"
   roleNameAttribute="cn"
   roleMemberAttribute="uniqueMember"
   roleObjectClass="groupOfUniqueNames";
   };

码头.xml

    <bean id="ldapLoginService" class="org.eclipse.jetty.jaas.JAASLoginService">
        <property name="name" value="LdapRealm" />
        <property name="loginModuleName" value="amqLdapLoginModule" />
        <property name="roleClassNames" value="org.eclipse.jetty.jaas.JAASRole" />
        <property name="identityService" ref="identityService" />
    </bean>
    <bean id="identityService" class="org.eclipse.jetty.security.DefaultIdentityService"/>

    <bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
        <property name="name" value="BASIC" />
        <property name="roles" value="admins-group" />
        <!-- set authenticate=false to disable login -->
        <property name="authenticate" value="true" />
    </bean>
    <bean id="adminSecurityConstraint" class="org.eclipse.jetty.util.security.Constraint">
        <property name="name" value="BASIC" />
        <property name="roles" value="admins-group" />
         <!-- set authenticate=false to disable login -->
        <property name="authenticate" value="true" />
    </bean>


    <bean id="securityHandlerLdap" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
        <property name="loginService" ref="ldapLoginService" />
        <property name="identityService" ref="identityService" />
        <property name="realmName" value="LdapRealm" />
        <property name="authenticator">
            <bean class="org.eclipse.jetty.security.authentication.BasicAuthenticator" />
        </property>
        <property name="constraintMappings">
            <list>
                <ref bean="adminSecurityConstraintMapping" />
                <ref bean="securityConstraintMapping" />
            </list>
        </property>
        <property name="handler" ref="secHandlerCollection" />
    </bean>

    <bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
    </bean>

遵循指南http://bacedifo.blogspot.com/2013/06/securing-activemq-580-web-console-using.html http://bacedifo.blogspot.com/2013/06/securing-activemq-580-web-console-using.html并使用 ldaptive ldap java 库并对配置进行一些调整,我设法使其适用于我们的 AD 环境。

将 ldaptive-{版本号}.jar 和 jetty-jass-{版本号}.jar 复制到 /activemq/lib 目录。

登录配置文件

activemq {
    org.ldaptive.jaas.LdapLoginModule required
        debug=true
        storePass="true"
        ldapUrl="ldap://ldap-server1.domainname.com:389 ldap://ldap-server2.domainname.com:389"
        connectionStrategy="ACTIVE_PASSIVE"
        bindDn="CN=ldap-readaccount,OU=Read Accounts,DC=domainname,DC=com"
        baseDn="OU=accounts,DC=domainname,DC=com"
        bindCredential="ldapuser-password"
        useStartTLS="false"
        userFilter="(sAMAccountName={user})";

    org.ldaptive.jaas.LdapRoleAuthorizationModule required
        useFirstPass="true"
        ldapUrl="ldap://ldap-server1.domainname.com:389 ldap://ldap-server2.domainname.com:389"
        connectionStrategy="ACTIVE_PASSIVE"
        bindDn="CN=ldap-readaccount,OU=Read Accounts,DC=domainname,DC=com"
        baseDn="OU=groups,DC=domainname,DC=com"
        bindCredential="ldapuser-password"
        roleFilter="(&(cn=webconsoleadmins)(member={user}))"
        useStartTLS="false"
        defaultRole="admins"
        roleAttribute="cn";

};

码头.xml

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="securityLoginService" class="org.eclipse.jetty.jaas.JAASLoginService">
    <property name="name" value="LdapRealm" />
    <property name="loginModuleName" value="activemq" />
    <property name="roleClassNames" value="org.ldaptive.jaas.LdapRole" />
    <property name="identityService" ref="identityService" />
</bean>
<bean id="identityService" class="org.eclipse.jetty.security.DefaultIdentityService"/>


<bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
    <property name="name" value="BASIC" />
    <property name="roles" value="admins,webconsoleadmins" />
    <!-- set authenticate=false to disable login -->
    <property name="authenticate" value="true" />
</bean>
<bean id="adminSecurityConstraint" class="org.eclipse.jetty.util.security.Constraint">
    <property name="name" value="BASIC" />
    <property name="roles" value="admins,webconsoleadmins" />
     <!-- set authenticate=false to disable login -->
    <property name="authenticate" value="true" />
</bean>

...

<bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
    <property name="loginService" ref="securityLoginService" />
    <property name="identityService" ref="identityService" />
    <property name="authenticator">
        <bean class="org.eclipse.jetty.security.authentication.BasicAuthenticator" />
    </property>
    <property name="constraintMappings">
        <list>
            <ref bean="adminSecurityConstraintMapping" />
            <ref bean="securityConstraintMapping" />
        </list>
    </property>
    <property name="handler" ref="secHandlerCollection" />
</bean>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 LDAP Active Directory 身份验证的 ActiveMQ Web 控制台 的相关文章

随机推荐

  • Flutter:如何获取 Firestore 中集合的所有文档名称

    我使用 Firestore 在 Flutter 中制作了一个应用程序 现在我将浏览集合中的所有文档 我想获取文档名称 id 和文档字段 并对其执行某些操作 我已经制作了一个显示数据的列表视图 但我无法用它做一些事情 例如 将其添加到列表或其
  • 多线程应用程序执行 onclickBtn 后挂起

    我正在 javaFx 中编写一个天气应用程序 从 openweather org 获取数据 从 openweather 获取 JSON 的整个代码工作正常 也将 JSON 数据转换为对象 我使用lambda表达式来实现Runnable in
  • Python 习语与多次调用 os.path.dirname 获得相同的结果?

    我发现自己需要在源树中获取 python 文件的父目录 该源树是具有一定规律性的多个目录 必须多次调用 dirname 很笨拙 我环顾四周 很惊讶没有找到关于此的帖子 一般场景是 import os path as op third deg
  • 如何在 MSVC 下检测 C++11 的 noexcept 功能?

    我正在使用 C 库 该库的最低要求是 C 03 我在 Visual Studio 2015 下收到一些关于抛出析构函数的警告 algparam h 271 warning C4297 AlgorithmParametersBase Algo
  • 前端和后端可以共享同一个package.json吗?

    我有一个小型个人项目 正在一个存储库中开发 后端是 Node js 服务器 前端是 Vue js 应用程序 我希望它们共享相同的 package json 我想这样做的唯一原因是因为我想使用 scripts 一个通用的 package js
  • 如何解决松散耦合/依赖注入和富域模型之间的冲突?

    Edit 这不是理论层面的冲突 而是实施层面的冲突 另一个编辑 问题在于域模型不作为纯数据 DTO 而不是更丰富 更复杂的对象映射 其中 Order 具有 OrderItems 和一些calculateTotal 逻辑 具体问题是 例如 该
  • 在下次调用之前中断 spring 调度程序任务

    我有一个 Spring Boot 应用程序 它将成为我们想要触发的其他几个进程的编排服务 我目前使用 Spring Scheduling 从数据库动态提取 cron 来设置它 我引入了一个休息方法来触发从数据库中提取新的 cron 信息的过
  • 在 c++11 中全局修复种子

    我正在尝试使用新的c
  • 如何捕获和查看 Cortex-M4 MCU 上的 ITM 跟踪信息?

    我想捕获 解码和查看 Cortex M4 MCU 在我的例子中是 Atmel SAM4S 的 ITM 跟踪信息 特别是 我想捕获与板上其他信号相关的异常和用户跟踪数据 即在同一时间线上显示所有信号和跟踪信息 这可以通过以下步骤完成 将调试器
  • AngularJS 指令绑定具有多个参数的函数

    我在将控制器中定义的函数与指令中的回调函数绑定时遇到一些问题 我的代码如下所示 在我的控制器中 scope handleDrop function elementId file console log handleDrop called 然
  • 在sql server中对加密列建立索引

    我将患者健康信息存储在 SQL Server 2012 数据库中 当我搜索病人的姓名时 他们的名字是加密的 所以搜索速度非常慢 如何在加密列上添加索引 我在 varbinary 字段上使用对称密钥加密 256 位 AES 患者的名字 姓氏
  • Maven 版本控制最佳实践 [关闭]

    Closed 这个问题是基于意见的 help closed questions 目前不接受答案 更改 Maven 项目版本 发布此版本然后返回到的最佳方法是什么 SNAPSHOT发展 目前我正在做以下事情 检索当前版本 最有可能的是SNAP
  • 如何绘制多列的条形图 3D 投影

    我有一个表 其中包含根据两个不同参数的三个不同时间特征 我想在 x 轴和 y 轴上绘制这些参数 并在 z 轴上显示三个不同时间的条形 我创建了一个简单的条形图 其中绘制了其中一个时间特征 import numpy as np import
  • 是否可以将数据从 DelegatingHandler 传递到 ASP.NET Web API 中的控制器?

    我正在实现一个与授权相关的 DelegatingHandler 其中我从数据库加载 api 用户 调用者 配置文件 当授权成功时 我想将此实例传递给控制器 否则我必须再次加载它 有没有办法在不使用会话或依赖存储库缓存的情况下执行此操作 Ht
  • 当网格被过滤时,Kendo 工具栏 AddNew 按钮不起作用

    我有一个小的剑道网格 设置如下 以一种令人难以置信的神秘方式 添加新 的控制器操作 即BatchCreate仅当您在单击 添加新项 后单击另一个命令按钮时才会调用 例如 a 单击 添加新的 什么也没有发生 b 重新加载页面 点击 Add N
  • 了解第 3 方 iframe 安全性?

    Facebook 和其他公司提供了一些小的 iframe 片段 我可以将它们放入我的网站中 例子 我想知道的是 如果我把这段代码放在我这边 他们加载到我页面中的代码可以访问我页面的 DOM 吗 如果是的话 我看到一些安全问题 同样 Face
  • 在 Haskell 中模拟路径依赖类型

    这是我想做的事情的一个简化示例 假设你有一个HList对 let hlist HCons 1 1 HCons 0 2 HCons 0 1 5 HNil 现在我想写一个函数replaceAll它将用相同类型的第一个 值 替换给定类型的所有 键
  • 随机选择ArangoDB中的一个文档

    有没有办法使用 AQL 从集合中随机返回文档 我想创建一个随机图用于测试目的 我还没有弄清楚如何从集合中随机选择文档 我希望我能够做这样的事情 db query RETURN nodes RAND 0 LENGTH nodes toArra
  • 在 React Native 中如何更改 Android 上的根视图背景颜色?

    我在网上读过一些教程 但大部分都是关于 iOS 的 或者一些关于 Android 的 但是使用旧版本的 React 现在一切都变了 如果我打开 MainActivity java 只有一种方法 Override protected Stri
  • 使用 LDAP Active Directory 身份验证的 ActiveMQ Web 控制台

    努力让 ActiveMQ Web 控制台使用 LDAP 并根据 Active Directory 进行身份验证 启动 MQ 时没有错误 出现用户名 密码登录框提示 但在插入正确的凭据时没有进展 Version 5 15 6 登录配置 amq