Skip to content
代码片段 群组 项目
提交 a1de50cb 编辑于 作者: Evan Read's avatar Evan Read
浏览文件

Merge branch 'alvin-master-patch-88113' into 'master'

Add OID filter example to LDAP troubleshooting doc

See merge request gitlab-org/gitlab!83669
No related branches found
No related tags found
无相关合并请求
...@@ -71,7 +71,28 @@ options = { ...@@ -71,7 +71,28 @@ options = {
filter: Net::LDAP::Filter.eq('cn', '*'), filter: Net::LDAP::Filter.eq('cn', '*'),
# :attributes is optional # :attributes is optional
# the attributes we want to get returnedk # the attributes we want to get returned
attributes: %w(dn cn memberuid member submember uniquemember memberof)
}
adapter.ldap_search(options)
```
When using OIDs in the filter, replace `Net::LDAP::Filter.eq` with `Net::LDAP::Filter.construct`:
```ruby
adapter = Gitlab::Auth::Ldap::Adapter.new('ldapmain')
options = {
# :base is required
# use .base or .group_base
base: adapter.config.base,
# :filter is optional
# This filter includes OID 1.2.840.113556.1.4.1941
# It will search for all direct and nested members of the group gitlab_grp in the LDAP directory
filter: Net::LDAP::Filter.construct("(memberOf:1.2.840.113556.1.4.1941:=CN=gitlab_grp,DC=example,DC=com)"),
# :attributes is optional
# the attributes we want to get returned
attributes: %w(dn cn memberuid member submember uniquemember memberof) attributes: %w(dn cn memberuid member submember uniquemember memberof)
} }
adapter.ldap_search(options) adapter.ldap_search(options)
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册