Commit c95f3128 authored by fangxinjiang's avatar fangxinjiang

代码优化

parent 571c7e78
...@@ -42,8 +42,6 @@ import org.springframework.security.core.userdetails.UserDetails; ...@@ -42,8 +42,6 @@ import org.springframework.security.core.userdetails.UserDetails;
@RequiredArgsConstructor @RequiredArgsConstructor
public class YifuUserDetailsServiceImpl implements YifuUserDetailsService { public class YifuUserDetailsServiceImpl implements YifuUserDetailsService {
//private final RemoteUserService remoteUserService;
private final CacheManager cacheManager; private final CacheManager cacheManager;
private final DaprUpmsProperties daprUpmsProperties; private final DaprUpmsProperties daprUpmsProperties;
...@@ -57,13 +55,11 @@ public class YifuUserDetailsServiceImpl implements YifuUserDetailsService { ...@@ -57,13 +55,11 @@ public class YifuUserDetailsServiceImpl implements YifuUserDetailsService {
@SneakyThrows @SneakyThrows
public UserDetails loadUserByUsername(String username) { public UserDetails loadUserByUsername(String username) {
Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS); Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS);
Object o = cache.get(username);
if (cache != null && cache.get(username) != null) { if (cache != null && cache.get(username) != null) {
return (YifuUser) cache.get(username).get(); return (YifuUser) cache.get(username).get();
} }
R<UserInfo> result;// = remoteUserService.info(username, SecurityConstants.FROM_IN); R<UserInfo> result = HttpDaprUtil.invokeMethodGet(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId(), "/user/getInfoByUsername", "?username="+username, UserInfo.class);
result = HttpDaprUtil.invokeMethodGet(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId(), "/user/getInfoByUsername", "?username="+username, UserInfo.class);
UserDetails userDetails = getUserDetails(result); UserDetails userDetails = getUserDetails(result);
if (cache != null) { if (cache != null) {
cache.put(username, userDetails); 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