Commit c95f3128 authored by fangxinjiang's avatar fangxinjiang

代码优化

parent 571c7e78
......@@ -42,8 +42,6 @@ import org.springframework.security.core.userdetails.UserDetails;
@RequiredArgsConstructor
public class YifuUserDetailsServiceImpl implements YifuUserDetailsService {
//private final RemoteUserService remoteUserService;
private final CacheManager cacheManager;
private final DaprUpmsProperties daprUpmsProperties;
......@@ -57,13 +55,11 @@ public class YifuUserDetailsServiceImpl implements YifuUserDetailsService {
@SneakyThrows
public UserDetails loadUserByUsername(String username) {
Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS);
Object o = cache.get(username);
if (cache != null && cache.get(username) != null) {
return (YifuUser) cache.get(username).get();
}
R<UserInfo> result;// = remoteUserService.info(username, SecurityConstants.FROM_IN);
result = HttpDaprUtil.invokeMethodGet(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId(), "/user/getInfoByUsername", "?username="+username, UserInfo.class);
R<UserInfo> result = HttpDaprUtil.invokeMethodGet(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId(), "/user/getInfoByUsername", "?username="+username, UserInfo.class);
UserDetails userDetails = getUserDetails(result);
if (cache != null) {
cache.put(username, userDetails);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment