From 7b71412a630d20ef3f6b354ae9767815bc37a149 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 26 Dec 2023 16:38:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=A1=E5=88=9B=E5=8D=95=E7=82=B9=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hz/pm/api/user/security/auth/mh/MhAuthFilter.java | 2 -- .../hz/pm/api/user/security/auth/mh/MhLoginUserDetailService.java | 7 ++----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhAuthFilter.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhAuthFilter.java index 1610391..6ba2f91 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhAuthFilter.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhAuthFilter.java @@ -54,8 +54,6 @@ public class MhAuthFilter extends AbstractAuthenticationProcessingFilter { MhAuthToken authRequest = new MhAuthToken(mhUserIdOrOpenId, mhUserIdOrOpenId); authRequest.setDetails(new WebRequestDetails(request)); return this.getAuthenticationManager().authenticate(authRequest); - } catch (AuthenticationException e) { - throw new BadCredentialsException("用户id 不能为空"); } catch (BizException e) { throw new BadCredentialsException(e.getMessage()); } catch (Exception e) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhLoginUserDetailService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhLoginUserDetailService.java index 78d62d7..7e1b588 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhLoginUserDetailService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhLoginUserDetailService.java @@ -2,17 +2,14 @@ package com.hz.pm.api.user.security.auth.mh; import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.user.constant.UserAvailableEnum; import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; import com.hz.pm.api.user.security.auth.model.UserInfoDetails; -import com.hz.pm.api.user.security.auth.validate.CommonLoginException; +import com.ningdatech.basic.exception.BizException; import lombok.RequiredArgsConstructor; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; -import java.util.Objects; - import static com.hz.pm.api.user.constant.UserAvailableEnum.DISABLE; /** @@ -33,7 +30,7 @@ public class MhLoginUserDetailService implements UserDetailsService { public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { UserFullInfoDTO userInfo = userInfoHelper.getUserFullInfoByMhUserIdOrOpenId(username); if (userInfo == null || DISABLE.equals(userInfo.getAvailable())) { - throw new UsernameNotFoundException("用户不存在或已被禁用"); + throw BizException.wrap("用户不存在或已被禁用"); } UserInfoDetails userDetails = new UserInfoDetails(); userDetails.setUserId(userInfo.getUserId());