当前位置: 首页 > 知识库问答 >
问题:

使用DEX(LDAP)进行身份验证时组为空

窦成荫
2023-03-14

我一直在尝试使用DEX for LDAP来验证OIDC。我已经成功地进行了身份验证,但问题是,LDAP搜索没有返回组。下面是我的DEX配置和LDAP数据。请帮帮我

截图:登录成功,群为空

我的Dex配置

# User search maps a username and password entered by a user to a LDAP entry.
userSearch:
# BaseDN to start the search from. It will translate to the query
# "(&(objectClass=person)(uid=<username>))".
baseDN: ou=People,dc=ec2-54-185-211-121,dc=us-west-2,dc=compute,dc=amazonaws,dc=com
# Optional filter to apply when searching the directory.
#filter: "(objectClass=posixAccount)"
# username attribute used for comparing user entries. This will be translated
# and combine with the other filter as "(<attr>=<username>)".
username: mail
# The following three fields are direct mappings of attributes on the user entry.
# String representation of the user.
idAttr: uid
# Required. Attribute to map to Email.
emailAttr: mail
# Maps to display name of users. No default value.
nameAttr: uid

# Group search queries for groups given a user entry.
groupSearch:
# BaseDN to start the search from. It will translate to the query
# "(&(objectClass=group)(member=<user uid>))".
baseDN: dc=ec2-54-185-211-121,dc=us-west-2,dc=compute,dc=amazonaws,dc=com
# Optional filter to apply when searching the directory.
#filter: "(objectClass=posixGroup)"
# Following two fields are used to match a user to a group. It adds an additional
# requirement to the filter that an attribute in the group must match the user's
# attribute value.
userAttr: uid
groupAttr: memberUid
# Represents group name.
nameAttr: cn

dn:uid=janedoe,ou=people,dc=ec2-54-185-211-121,dc=us-west-2,dc=compute,dc=amazonaws,dc=com gecos:janedoe uid:janedoe loginshell:/bin/bash mail:Jane.Doe@example.org homedirectory:/home/jdoe cn:Jane Doe sn:Doe uid number:10001 objectclass:posixAccount objectclass:inetOrgPerson objectclass:top userpassword:foo

dn:ou=Groups,dc=ec2-54-185-211-121,dc=us-west-2,dc=compute,dc=amazonaws,dc=com ou:Groups objectclass:organizationalUnit

dn:cn=admins,ou=groups,dc=ec2-54-185-211-121,dc=us-west-2,dc=compute,dc=amazonaws,dc=com cn:admins objectclass:posixGroup objectclass:top gidnumber:20001 memberuid:janedoe memberuid:johndoe

dn:cn=developers,ou=groups,dc=ec2-54-185-211-121,dc=us-west-2,dc=compute,dc=amazonaws,dc=com cn:developers objectclass:posixGroup objectclass:top gidnumber:20002 memberuid:janedoe

共有1个答案

葛兴发
2023-03-14

很抱歉重播晚了,但直到现在我还不知道答案:)

我也遇到了同样的问题,在我的设置中,我使用dex(quay.io/dexidp/dex:v2.16.0)来使用MS AD。我在测试中使用了Kubernetes1.13。

为了生成kubeconfig,我使用了Heptiolabs/Gangway(gcr.io/Heptio-images/Gangway:v3.0.0),为了处理仪表板登录,我使用了pusher/oauth2_proxy(quay.io/pusher/oauth2_proxy)

我花了很多时间在dex中尝试不同的ldap设置,但没有让广告组显示在dex日志中,也没有让他们在kubernetes中工作,而且我读到的每个示例都只使用用户。

我的问题和解决方案不在dex配置中,如果您告诉dex这样做,dex将从ldap请求组。都在客户身上。OIDC有一个作用域的“概念”,我猜最(所有?)oidc客户机实现了它,至少gangway和oauth2-proxy都实现了它。所以我的解决方案是配置客户机(在我的例子中是gangway和oauth2-proxy),以便他们也向dex请求组。

在gangway中,我使用了以下配置(包括注释)

# Used to specify the scope of the requested Oauth authorization.
# scopes: ["openid", "profile", "email", "offline_access"]
scopes: ["openid", "profile", "email", "offline_access", "groups"]
- args:
        - --scope=openid profile email groups

希望有帮助

--罗伯特

 类似资料:
  • 下面是我得到的错误(堆栈跟踪中列出的最后几个原因) 它似乎不喜欢contextSource bean的constructor-arg中列出的URL,尽管我不确定原因。 另外,我怀疑这个配置的其他部分是不正确的。例如,我在ldap-server标记和contextSource bean中定义了ldap服务器URL。这似乎是不必要的重复,但在示例中是这样做的。有人能好好看看配置,以确保它是正常的吗?

  • 我正在尝试使用spring security 2.0.3进行LDAP身份验证 下面是我的配置 我应该在哪里提到域名?

  • 我正在尝试将Spring身份验证与嵌入式ldap集成。 我在本地ldif文件中有用户信息。 用户1 用户2 Spring网络安全配置文件 配置文件中的userDnPattern我使用了ou=people(uid={0},ou=people),所以我可以对bob进行身份验证。说到乔,他的目录路径是不同的。所以我无法使用joe的用户名和密码登录。 无论目录结构如何,我对所有用户进行身份验证的Sprin

  • 我试图建立一个新的服务器,作为网关(使用sping-Cloud-网关作为基础),我需要能够在实际转发任何后续请求之前通过远程LDAP服务器验证用户。我将如何实现这个(包,配置等)?

  • 在这里尝试看看是否有人已经用Rundeck对AD进行了LDAP身份验证。我正在使用RunDesk的JRE运行方法。以下是我到目前为止所做的工作: 我已经设置了jaas-ldap.conf,如Rundeck authentication users页面所示 我已向管理员请求ssl证书。要使用ldaps,rundeck需要ssl证书,这是在他们的站点上编写的。获得证书后,他们提到以下两个步骤: 一旦获

  • 我正在尝试用.NET中的LDAP制作一个简单的身份验证系统。我检查了.NET中的一些名称空间,并简单地制作了标准代码片段,如下所示。 我有一个管理员用户名和密码和,用于对客户端应用程序进行身份验证。我有第二个用户名和密码和,需要在LDAP中检查才能登录。 是管理帐户,只是LDAP中的用户。那么如何检查的密码呢?