Skip to content

Commit

Permalink
[Bugfix] 修复在Ldap登录时,设置auth-user-registration: false会导致空指针的问题 (#1117)
Browse files Browse the repository at this point in the history
Configure LDAP And Set auth-user-registration: false will result in NPE(Null Pointer Exception) #1116 

---------

Co-authored-by: weidong_chang <weidong_chang@intsig.net>
  • Loading branch information
chang-wd and weidong_chang authored Aug 8, 2023
1 parent db40a5c commit ca696dd
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import com.xiaojukeji.know.streaming.km.account.common.bizenum.LoginServiceNameEnum;
import com.xiaojukeji.know.streaming.km.account.common.ldap.LdapPrincipal;
import com.xiaojukeji.know.streaming.km.account.login.ldap.remote.LdapAuthentication;
import com.xiaojukeji.know.streaming.km.common.constant.Constant;
import com.xiaojukeji.know.streaming.km.common.utils.CommonUtils;
import com.xiaojukeji.know.streaming.km.common.utils.ConvertUtil;
import com.xiaojukeji.know.streaming.km.common.utils.ValidateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -80,6 +80,10 @@ public UserBriefVO verifyLogin(AccountLoginDTO loginDTO,

// user赋值
user = userService.getUserByUserName(ldapAttrsInfo.getSAMAccountName());
} else if (ValidateUtils.isNull(user)) {
// user为空,且不自动注册用户时,赋值默认id给临时用户
user = new User();
user.setId(Constant.INVALID_CODE);
}

// 记录登录状态
Expand Down

0 comments on commit ca696dd

Please sign in to comment.