在 AuthLDAPURL 中是否可以有多个搜索过滤器?
示例 uid 过滤器:
<Location /test/>
AuthType Basic
AuthName "Test"
AuthBasicProvider ldap
AuthUserFile /dev/null
AuthLDAPURL ldap://example.test.com/o=test,c=com?uid
AuthLDAPBindDN "******"
AuthLDAPBindPassword ******
require ldap-group cn=group01,o=test,c=com
</Location>
Run Code Online (Sandbox Code Playgroud)
我们需要搜索uid或mail。喜欢...
AuthLDAPURL ldap://example.test.com/o=test,c=com?uid|mail
Run Code Online (Sandbox Code Playgroud)
解决方案(它对我有用):
使用 Apache 2.4 测试 http://httpd.apache.org/docs/current/mod/mod_authn_core.html
<AuthnProviderAlias ldap ldap-uid>
AuthLDAPBindDN "******"
AuthLDAPBindPassword ******
AuthLDAPURL "ldap://example.test.com/o=test,c=com?uid??(&(isMemberOf=cn=group01,o=test,c=com))"
</AuthnProviderAlias>
<AuthnProviderAlias ldap ldap-mail>
AuthLDAPBindDN "******"
AuthLDAPBindPassword ******
AuthLDAPURL "ldap://example.test.com/o=test,c=com?mail??(&(isMemberOf=cn=group01,o=test,c=com))"
</AuthnProviderAlias>
<Location "/test/">
Order deny,allow
Allow from all
AuthType Basic
AuthName "Login with mail or uid"
AuthBasicProvider ldap-uid ldap-mail
LDAPReferrals Off
Require valid-user
</Location>
Run Code Online (Sandbox Code Playgroud)
谢谢托宁!