From 257ad6fc282992144ae1097a8c884b511e006fc2 Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Tue, 14 Feb 2023 13:57:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/user/security/auth/credential/CredentialAuthProvider.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java index 46ec2ab..12612f5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java @@ -13,6 +13,8 @@ import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.password.PasswordEncoder; +import java.util.Objects; + /** * @Author LiuXinXin * @Date 2020/8/3 8:55 下午 @@ -44,6 +46,9 @@ public class CredentialAuthProvider implements AuthenticationProvider { throw new BadCredentialsException("login fail! 浙政钉校验失败"); } String accountId = accountResult.getData(); + if (Objects.isNull(accountId)) { + throw new BadCredentialsException("login fail! 浙政钉校验失败"); + } user = userDetailsService.loadUserByUsername(accountId + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); }