Spring 4 WebSockect over STOMP Authentication
I'm developing a multiplayer game based on Spring 4 WebSocket. my server is stateless so in order to identify players i use tokens. after struggling for sometime with how to identify players over WebSockets i came up with this solution: on the client player registers like this: var sockjs = new SockJS("http://mygame/games/", null, {server : token}); this adds the token to the url, I have set up a filter using spring security: String requestURI = request.getRequestURI(); String[] parts = StringUtils.split(requestURI, "/"); if (parts.length == 4) { String token = parts[1]; List<GrantedAuthority>