🐛 Fixing a bug. websocket 问题 修改,获取用户信息错误

This commit is contained in:
冷冷 committed 2019-04-28 13:40:47 +08:00
1 parent dfa8737d80
commit c11757d455
1 file changed
+1 -1
@@ -61,7 +61,7 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
OAuth2Authentication auth2Authentication = tokenService.loadAuthentication(tokens.split(" ")[1]);
if (ObjectUtil.isNotNull(auth2Authentication)) {
SecurityContextHolder.getContext().setAuthentication(auth2Authentication);
accessor.setUser(() -> (String) auth2Authentication.getPrincipal());
accessor.setUser(() -> auth2Authentication.getName());
return message;
} else {
return null;