refactor(LDAP): 登录时更新ldap用户信息
This commit is contained in:
parent
4f0751788f
commit
2786714482
|
@ -49,11 +49,13 @@ public class LdapController {
|
|||
|
||||
// userId 或 email 有一个相同即为存在本地用户
|
||||
User u = userService.selectUser(userId, email);
|
||||
String name = ldapService.getMappingAttr("name", dirContext);
|
||||
String phone = ldapService.getNotRequiredMappingAttr("phone", dirContext);
|
||||
if (u == null) {
|
||||
|
||||
// 新建用户 获取LDAP映射属性
|
||||
String name = ldapService.getMappingAttr("name", dirContext);
|
||||
String phone = ldapService.getNotRequiredMappingAttr("phone", dirContext);
|
||||
// String name = ldapService.getMappingAttr("name", dirContext);
|
||||
// String phone = ldapService.getNotRequiredMappingAttr("phone", dirContext);
|
||||
|
||||
User user = new User();
|
||||
user.setId(userId);
|
||||
|
@ -66,6 +68,12 @@ public class LdapController {
|
|||
|
||||
user.setSource(UserSource.LDAP.name());
|
||||
userService.addLdapUser(user);
|
||||
} else {
|
||||
// 更新
|
||||
u.setName(name);
|
||||
u.setPhone(phone);
|
||||
u.setEmail(email);
|
||||
userService.updateUser(u);
|
||||
}
|
||||
|
||||
// 执行 LocalRealm 中 LDAP 登录逻辑
|
||||
|
|
Loading…
Reference in New Issue