我正在通过sockJs开发一个带有spring-messaging和STOMP的服务器。 我想做授权trhought websockets。 所以从客户端我也送一些象征性的,然后我得到令牌针用户,我想我会与该用户相关联,我做下一个:春季消息+安全如何通过websockets登录?
private void authorizeUser(Profile profile) {
SignedUser signedUser = new SignedUser(profile);
List<GrantedAuthority> authorities = Arrays.asList(new SimpleGrantedAuthority("ROLE_USER"));
UsernamePasswordAuthenticationToken authentication =
new UsernamePasswordAuthenticationToken(signedUser, null, authorities);
SecurityContextHolder.getContext().setAuthentication(authentication);
}
但会议没有关联,任何人都可以帮我这个问题?
谢谢。
我面临着类似的问题,你是如何发送来自客户端的令牌? – 2015-06-24 06:25:33