5
Używam bardzo cienkiej implementacji Spring WebSockets. WebSocketSession ma metodę getPrincipal(), ale jak mogę ustawić ją z poziomu HandshakeInterceptora?Jak ustawić głównego w HandshakeInterceptor
Sposób chciałbym umieścić w Principal jest:
public boolean beforeHandshake(final ServerHttpRequest request, final ServerHttpResponse response, final WebSocketHandler wsHandler,
final Map<String, Object> attributes) throws Exception {
Principal = getPrincipal();
// Now where to set the principal so it is available in WebSocketSession?
}
Zobacz kodu źródłowego 'DefaultHandshakeHandler': jak robi się kontrakt z' RequestUpgradeStrategy'. I dalej każda implementacja 'RequestUpgradeStrategy'. –