October 2018
Intermediate to advanced
590 pages
15h 5m
English
Spring's WebSocket implementation provides a WebSocketSession interface that allows you to access the authenticated user's information from the WebSocketSession.getPrincipal() method. When the user is not authenticated, the result of this method will be null. We can use this to determine whether the user has been authenticated or not, which is very convenient.
However, when we need to separate the real-time-related feature into a standalone application, we cannot use the WebSocketSession.getPrincipla() method to retrieve the authenticated user's information unless we set up a clustered session using Spring Session. But that's not the only way. We can also use JWT to perform the authentication.
Read now
Unlock full access