-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
增强LDAP用户服务,支持按组查找用户 #1794
增强LDAP用户服务,支持按组查找用户 #1794
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1794 +/- ##
============================================
- Coverage 50.83% 50.17% -0.66%
- Complexity 1978 1979 +1
============================================
Files 398 400 +2
Lines 12185 12342 +157
Branches 1250 1272 +22
============================================
- Hits 6194 6193 -1
- Misses 5533 5691 +158
Partials 458 458
Continue to review full report at Codecov.
|
Looks nice, will take a detaild look soon! |
sorry, I want know if it support ldaps? |
@yanggz01 I don't have a ldaps environment, maybe you could do some test? |
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/LdapUserService.java
Outdated
Show resolved
Hide resolved
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/LdapUserService.java
Show resolved
Hide resolved
几位有空的话也帮忙review一下~ |
从我搜到的资料看 OpenLdap 是可以支持的,需要开启 memberOf overlay,apacheDS 有支持的计划,不过两三年了还没加上。换新的实现也可以,只要用户无感知,windows ad 的 case 我可以抽空测试一下 |
我参考了这篇文章在open ldap中开启了memberOf特性,和当前版本的功能是兼容的。 |
嗯,OpenLDAP是可以用这个办法开启memberOf属性,但是ApacheDS目前还不能支持memberOf属性;如果用ApacheDS就不能集成到Apollo里面来了 |
我这里用了Jenkins、Jfrog Artifactory、Gitlab、SonarQube都是支持group方式和memberOf方式两种,建议还是要把基于group方式的实现加入进来。 |
多谢反馈~ ApacheDS有比较简单的安装方式吗?另外,当前的PR能支持OpenLDAP吗?功能层面肯定是希望能支持更多的接入方式,不过在代码上希望能尽可能地保持简单和通用~ |
当前的Group方式是支持OpenLDAP的,其实只要是使用groupOfNames或者groupOfUniqueNames,使用member、uniqueMember属性设置成员(成员要完整的路径,不能是成员ID),应该都是支持的 ApacheDS Windows安装比较简单,官网下个安装包直接安装就可以了 Linux 下安装 wget http://mirrors.shu.edu.cn/apache//directory/apacheds/dist/2.0.0.AM25/apacheds-2.0.0.AM25-x86_64.rpm
yum install apacheds-2.0.0.AM25-x86_64.rpm
/etc/init.d/apacheds-2.0.0.AM25-default start 安装完成之后安装一个Apache Directory Studio 操作ApacheDS就可以了 这里有个文档可以参考: |
好的,我后面装一个ApacheDS试试,代码的话还有劳看下是否可以尽可能通用一些~ |
好 |
@nobodyiam 我修改了实现方式,现在支持按照memberUid和member两种方式查找用户,支持OpenLDAP和ApacheDS |
@idefav Thanks! Will take a detailed look soon! |
...al/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/FilterLdapByGroupUserSearch.java
Show resolved
Hide resolved
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/LdapUserService.java
Outdated
Show resolved
Hide resolved
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/LdapUserService.java
Outdated
Show resolved
Hide resolved
...al/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/FilterLdapByGroupUserSearch.java
Outdated
Show resolved
Hide resolved
...al/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/FilterLdapByGroupUserSearch.java
Outdated
Show resolved
Hide resolved
...al/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/FilterLdapByGroupUserSearch.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
enhance ldap user service to support filtering users by group
修改LdapUserService SPI接口实现
新增按照group去查找可用用户
以前的版本只能按照"memberOf"去分组,这个方式在ApacheDS和OpenLdap里面没有,只有Windows的ActiveDirectory可以用,修改之后的版本可以支持按照组去筛选用户
示例配置: application-ldap.yml
ApacheDS 截图:
Apollo Portal 使用截图: