!9 LDAP同步优化

- 优化:[API]LDAP的部门同步逻辑
- 优化:[API]LDAP的用户同步逻辑
This commit is contained in:
白书科技
2024-07-04 08:55:21 +00:00
parent 92a9f85171
commit 6541c3a191
7 changed files with 162 additions and 77 deletions

View File

@@ -67,6 +67,9 @@ public class LoginBus {
public HashMap<String, Object> tokenByLdapTransformUser(LdapTransformUser ldapTransformUser)
throws ServiceException {
User user = ldapBus.singleUserSync(ldapTransformUser, appConfigService.defaultAvatar());
if (user == null) {
throw new ServiceException("用户状态异常,无法登录!");
}
return tokenByUser(user);
}
}

View File

@@ -119,14 +119,7 @@ public class LoginController {
try {
LdapTransformUser ldapTransformUser =
LdapUtil.loginByMailOrUid(
ldapConfig.getUrl(),
ldapConfig.getAdminUser(),
ldapConfig.getAdminPass(),
ldapConfig.getBaseDN(),
mail,
uid,
req.getPassword());
LdapUtil.loginByMailOrUid(ldapConfig, mail, uid, req.getPassword());
if (ldapTransformUser == null) {
return JsonResponse.error("登录失败.请检查账号和密码");
}