From cf88fa20a244594d99f551cb4511af89f51f5124 Mon Sep 17 00:00:00 2001 From: Lierbao Date: Wed, 4 Jan 2023 17:08:29 +0800 Subject: [PATCH] userInfo userAuth --- .../pmapi/user/manage/UserAuthLoginManage.java | 12 ++++++++++++ .../pmapi/user/security/auth/model/UserFullInfoDTO.java | 12 ++++++++++++ .../auth/password/PasswordLoginUserDetailService.java | 16 +++++++++------- 3 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java index 470c9c3..93ea820 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java @@ -1,5 +1,9 @@ package com.ningdatech.pmapi.user.manage; +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.pmapi.user.service.IUserAuthService; +import com.ningdatech.pmapi.user.service.IUserInfoService; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; /** @@ -8,5 +12,13 @@ import org.springframework.stereotype.Component; */ @Component +@RequiredArgsConstructor public class UserAuthLoginManage { + + private final IUserAuthService iUserAuthService; + private final IUserInfoService iUserInfoService; + + public UserFullInfoDTO queryUserInfoInPasswordAuth(String username){ + return null; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java new file mode 100644 index 0000000..34e73f3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java @@ -0,0 +1,12 @@ +package com.ningdatech.pmapi.user.security.auth.model; + +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/1/4 下午5:07 + */ + +@Data +public class UserFullInfoDTO { +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/password/PasswordLoginUserDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/password/PasswordLoginUserDetailService.java index 6dbe98e..4c77e9b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/password/PasswordLoginUserDetailService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/password/PasswordLoginUserDetailService.java @@ -2,12 +2,15 @@ package com.ningdatech.pmapi.user.security.auth.password; import com.ningdatech.pmapi.user.manage.UserAuthLoginManage; +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; 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; + /** * @author LiuXinXin * @date 2022/9/30 上午9:49 @@ -21,11 +24,11 @@ public class PasswordLoginUserDetailService implements UserDetailsService { @Override public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { -// UserFullInfoDTO userFullInfoDTO = userAuthLoginFacade.queryUserInfoInPasswordAuth(username); -// if (Objects.isNull(userFullInfoDTO)) { -// throw new UsernameNotFoundException(String.format("%s user not exist", username)); -// } -// UserInfoDetails userInfoDetails = new UserInfoDetails(); + UserFullInfoDTO userFullInfoDTO = userAuthLoginManage.queryUserInfoInPasswordAuth(username); + if (Objects.isNull(userFullInfoDTO)) { + throw new UsernameNotFoundException(String.format("%s user not exist", username)); + } + UserInfoDetails userInfoDetails = new UserInfoDetails(); // userInfoDetails.setUserId(userFullInfoDTO.getUserId()); // userInfoDetails.setUsername(userFullInfoDTO.getUsername()); // userInfoDetails.setRealName(userFullInfoDTO.getRealName()); @@ -35,7 +38,6 @@ public class PasswordLoginUserDetailService implements UserDetailsService { // userInfoDetails.setResponsibleCompanyIdList(userFullInfoDTO.getResponsibleCompanyIdList()); // userInfoDetails.setIdentifier(userFullInfoDTO.getIdentifier()); // userInfoDetails.setPassword(userFullInfoDTO.getCredential()); -// return userInfoDetails; - return null; + return userInfoDetails; } }