|
@@ -6,6 +6,7 @@ import com.ningdatech.pmapi.user.manage.UserAuthLoginManage; |
|
|
import com.ningdatech.pmapi.user.security.auth.constants.UserDeatilsServiceConstant; |
|
|
import com.ningdatech.pmapi.user.security.auth.constants.UserDeatilsServiceConstant; |
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; |
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; |
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; |
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; |
|
|
|
|
|
import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import org.springframework.security.core.userdetails.UserDetailsService; |
|
|
import org.springframework.security.core.userdetails.UserDetailsService; |
|
|
import org.springframework.security.core.userdetails.UsernameNotFoundException; |
|
|
import org.springframework.security.core.userdetails.UsernameNotFoundException; |
|
@@ -35,14 +36,23 @@ public class CredentialLoginUserDetailService implements UserDetailsService { |
|
|
switch (loginTypeEnum) { |
|
|
switch (loginTypeEnum) { |
|
|
case PHONE_VERIFICATION_CODE_LOGIN: { |
|
|
case PHONE_VERIFICATION_CODE_LOGIN: { |
|
|
userFullInfoDTO = userAuthLoginManage.queryUserInfoInPhoneNoAuth(username); |
|
|
userFullInfoDTO = userAuthLoginManage.queryUserInfoInPhoneNoAuth(username); |
|
|
|
|
|
if (Objects.isNull(userFullInfoDTO)) { |
|
|
|
|
|
throw new CommonLoginException("改手机号未绑定用户"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
case USERNAME_PASSWORD_LOGIN: { |
|
|
case USERNAME_PASSWORD_LOGIN: { |
|
|
userFullInfoDTO = userAuthLoginManage.queryUserInfoInPasswordAuth(username); |
|
|
userFullInfoDTO = userAuthLoginManage.queryUserInfoInPasswordAuth(username); |
|
|
|
|
|
if (Objects.isNull(userFullInfoDTO)) { |
|
|
|
|
|
throw new UsernameNotFoundException(String.format("%s user not exist", username)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
case DING_QR_LOGIN: { |
|
|
case DING_QR_LOGIN: { |
|
|
userFullInfoDTO = userAuthLoginManage.queryUserInfoInAccountIdAuth(username); |
|
|
userFullInfoDTO = userAuthLoginManage.queryUserInfoInAccountIdAuth(username); |
|
|
|
|
|
if (Objects.isNull(userFullInfoDTO)) { |
|
|
|
|
|
throw new CommonLoginException("浙政钉账号无法登陆"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
default: { |
|
|
default: { |
|
@@ -50,9 +60,6 @@ public class CredentialLoginUserDetailService implements UserDetailsService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (Objects.isNull(userFullInfoDTO)) { |
|
|
|
|
|
throw new UsernameNotFoundException(String.format("%s user not exist", username)); |
|
|
|
|
|
} |
|
|
|
|
|
UserInfoDetails userInfoDetails = new UserInfoDetails(); |
|
|
UserInfoDetails userInfoDetails = new UserInfoDetails(); |
|
|
userInfoDetails.setUserId(userFullInfoDTO.getUserId()); |
|
|
userInfoDetails.setUserId(userFullInfoDTO.getUserId()); |
|
|
userInfoDetails.setUsername(userFullInfoDTO.getUsername()); |
|
|
userInfoDetails.setUsername(userFullInfoDTO.getUsername()); |
|
|