Quellcode durchsuchen

信创单点登录修改

tags/24080901
WendyYang vor 1 Jahr
Ursprung
Commit
7b71412a63
2 geänderte Dateien mit 2 neuen und 7 gelöschten Zeilen
  1. +0
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhAuthFilter.java
  2. +2
    -5
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhLoginUserDetailService.java

+ 0
- 2
hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhAuthFilter.java Datei anzeigen

@@ -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) {


+ 2
- 5
hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhLoginUserDetailService.java Datei anzeigen

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


Laden…
Abbrechen
Speichern