|
|
@ -2,7 +2,6 @@ package com.cloud.kicc.common.security.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.cloud.kicc.common.core.api.R; |
|
|
|
import com.cloud.kicc.common.core.api.R; |
|
|
|
import com.cloud.kicc.common.core.constant.SecurityConstants; |
|
|
|
import com.cloud.kicc.common.core.constant.SecurityConstants; |
|
|
|
import com.cloud.kicc.common.core.exception.CheckedException; |
|
|
|
|
|
|
|
import com.cloud.kicc.common.security.service.KiccUserDetailsService; |
|
|
|
import com.cloud.kicc.common.security.service.KiccUserDetailsService; |
|
|
|
import com.cloud.kicc.system.api.entity.User; |
|
|
|
import com.cloud.kicc.system.api.entity.User; |
|
|
|
import com.cloud.kicc.system.api.feign.RemoteUserService; |
|
|
|
import com.cloud.kicc.system.api.feign.RemoteUserService; |
|
|
@ -11,6 +10,7 @@ import lombok.SneakyThrows; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.context.annotation.Primary; |
|
|
|
import org.springframework.context.annotation.Primary; |
|
|
|
import org.springframework.security.core.userdetails.UserDetails; |
|
|
|
import org.springframework.security.core.userdetails.UserDetails; |
|
|
|
|
|
|
|
import org.springframework.security.core.userdetails.UsernameNotFoundException; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
*<p> |
|
|
|
*<p> |
|
|
@ -37,7 +37,7 @@ public class KiccUserDetailsServiceImpl implements KiccUserDetailsService { |
|
|
|
public UserDetails loadUserByUsername(String username) { |
|
|
|
public UserDetails loadUserByUsername(String username) { |
|
|
|
R<User> result = remoteUserService.selectByUserName(username, SecurityConstants.FROM_IN); |
|
|
|
R<User> result = remoteUserService.selectByUserName(username, SecurityConstants.FROM_IN); |
|
|
|
if (result == null || result.getData() == null) { |
|
|
|
if (result == null || result.getData() == null) { |
|
|
|
throw new CheckedException("用户不存在"); |
|
|
|
throw new UsernameNotFoundException("用户不存在!"); |
|
|
|
} |
|
|
|
} |
|
|
|
UserDetails userDetails = getUserDetails(result); |
|
|
|
UserDetails userDetails = getUserDetails(result); |
|
|
|
return userDetails; |
|
|
|
return userDetails; |
|
|
|