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());