Merge pull request #1979 from dataease/pr@dev@fix_login_type_error

fix: 登录验证用户来源
This commit is contained in:
fit2cloud-chenyw 2022-03-28 15:38:55 +08:00 committed by GitHub
commit 4aeaf0659d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -91,6 +91,11 @@ public class AuthServer implements AuthApi {
SysUserEntity user = authUserService.getUserByName(username); SysUserEntity user = authUserService.getUserByName(username);
// 验证登录类型是否与用户类型相同
if (!sysUserService.validateLoginType(user.getFrom(), loginType)) {
DataEaseException.throwException(Translator.get("i18n_id_or_pwd_error"));
}
if (ObjectUtils.isEmpty(user)) { if (ObjectUtils.isEmpty(user)) {
DataEaseException.throwException(Translator.get("i18n_id_or_pwd_error")); DataEaseException.throwException(Translator.get("i18n_id_or_pwd_error"));
} }

View File

@ -156,6 +156,11 @@ public class SysUserService {
}); });
} }
public boolean validateLoginType(Integer from, Integer loginType) {
return ObjectUtils.isNotEmpty(from) && ObjectUtils.isNotEmpty(loginType) && from == loginType;
}
public List<String> ldapUserNames() { public List<String> ldapUserNames() {
List<String> usernames = extSysUserMapper.ldapUserNames(1); List<String> usernames = extSysUserMapper.ldapUserNames(1);