java - 请检查 JNDI 领域配置
问题描述
我的 Tomcat Web 应用程序日志告诉我 user1 不在来自 AD 的指定映射 LDAP 角色/组中。我相信我的问题在于 JNDI 领域的定义。有人可以查看它,看看我哪里出错了,我也包含了来自 AD 的 DN 信息:
我的“user1”帐户 DN 是
DistinguishedName : CN=user1,OU=Users,OU=Lab,DC=example,DC=com
我在 web.xml 配置中指定的角色/组“用户”是
DistinguishedName : CN=Users,CN=Builtin,DC=example,DC=com
我的领域配置是
<Realm
className="org.apache.catalina.realm.JNDIRealm"
debug="99"
connectionURL="ldap://example.com:389"
authentication="simple"
referrals="follow"
connectionName="cn=administrator,cn=users,dc=example,dc=com"
connectionPassword="##########"
userSearch="(sAMAccountName={0})"
userBase="cn=users,dc=example,dc=com"
userSubtree="true"
userRoleName="memberOf"
roleSearch="(member={0})"
roleName="cn"
roleSubtree="true"
roleBase="cn=users,cn=builtin,dc=example,dc=com"/>
解决方案
修好了自己。这是正确的配置。
<Realm
className="org.apache.catalina.realm.JNDIRealm"
debug="99"
connectionURL="ldap://example.com:3268"
authentication="simple"
referrals="follow"
connectionName="cn=administrator,cn=users,dc=example,dc=com"
connectionPassword="########"
userSearch="(sAMAccountName={0})"
userBase="dc=example,dc=com"
userSubtree="true"
userRoleName="memberOf"
roleName="cn"
roleSubtree="true"/>
推荐阅读
- tensorflow - 部署经过训练的模型
- python - 几分钟后 Google App Engine 内部服务器错误
- powershell - 脚本运行时如何防止输入在控制台中显示
- javascript - 在单独的框中显示 html 表格内容
- apache-kafka-streams - kafka connect可以直接创建流吗?
- angular - 订阅 BehaviorSubject 在 Angular 8 中引发错误
- firebase - Firebase:在 NoSQL 中使用维度/事实表设计是个好主意吗
- sql - 如何选择总数?
- php - 在php电子邮件中发送多个复选框值
- node.js - AWS Lambda 仅调用第一个承诺函数