Skip to content

Commit d241603

Browse files
committed
fix: 修复ldap因用户过滤条件不匹配不支持部分ldap服务的问题; #237
1 parent 007006e commit d241603

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rnacos"
3-
version = "0.6.19"
3+
version = "0.6.20-beta"
44
authors = ["heqingpan <[email protected]>"]
55
edition = "2018"
66
license = "Apache-2.0"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ k8s支持使用 [helm](https://github.com/nacos-group/r-nacos/tree/master/deploy
195195
|RNACOS_LDAP_ENABLE|是否启用LDAP认证|false|false|0.6.19|
196196
|RNACOS_LDAP_URL|LDAP服务器地址|空字符串|ldap://localhost:389|0.6.19|
197197
|RNACOS_LDAP_USER_BASE_DN|LDAP用户基础DN|空字符串|ou=people,dc=example,dc=com|0.6.19|
198-
|RNACOS_LDAP_USER_FILTER|LDAP用户过滤器|空字符串|(objectClass=person)|0.6.19|
198+
|RNACOS_LDAP_USER_FILTER|LDAP用户过滤器|空字符串|(&(objectClass=person)(uid=%s))|0.6.19|
199199
|RNACOS_LDAP_USER_DEVELOPER_GROUP|LDAP开发者角色包含的用户组(多个用逗号分隔,用户只要包含一个就是开发者)|空集合|dev_group1,dev_group2|0.6.19|
200200
|RNACOS_LDAP_USER_ADMIN_GROUP|LDAP管理员角色包含的用户组(多个用逗号分隔,用户只要包含一个就是管理员)|空集合|admin_group1,admin_group2|0.6.19|
201201
|RNACOS_LDAP_USER_DEFAULT_ROLE|LDAP用户默认角色,支持的值有:访客:VISITOR,开发者:DEVELOPER,管理员:ADMIN|VISITOR|DEVELOPER|0.6.19|

doc/conf/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ RNACOS_LDAP_ENABLE=false
8585
#LDAP用户基础DN,默认值为空字符串
8686
#RNACOS_LDAP_USER_BASE_DN=ou=people,dc=example,dc=com
8787
#LDAP用户过滤器,默认值为空字符串
88-
#RNACOS_LDAP_USER_FILTER=(objectClass=person)
88+
#RNACOS_LDAP_USER_FILTER=(&(objectClass=person)(uid=%s))
8989
#LDAP开发者角色包含的用户组(多个用逗号分隔,用户只要包含一个就是开发者),默认值为空集合
9090
#RNACOS_LDAP_USER_DEVELOPER_GROUP=dev_group1,dev_group2
9191
#LDAP管理员角色包含的用户组(多个用逗号分隔,用户只要包含一个就是管理员),默认值为空集合

src/ldap/ldap_msg_actor.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ impl LdapMsgActor {
5353
ldap.simple_bind(&bind_dn, &bind_req.password)
5454
.await?
5555
.success()?;
56-
let filter = format!(
57-
"(&{}(cn={}))",
58-
ldap_config.ldap_user_filter, &bind_req.user_name
59-
);
56+
let filter = ldap_config.ldap_user_filter.replace("%s", &bind_req.user_name);
6057
let (mut rs, _res) = ldap
6158
.search(
6259
&ldap_config.ldap_user_base_dn,

0 commit comments

Comments
 (0)