|
|
@ -41,14 +41,9 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { |
|
|
|
public Message<?> preSend(Message<?> message, MessageChannel channel) { |
|
|
|
StompHeaderAccessor accessor = |
|
|
|
MessageHeaderAccessor.getAccessor(message, StompHeaderAccessor.class); |
|
|
|
if (StompCommand.CONNECT.equals(accessor.getCommand())) { |
|
|
|
List<String> authorization = accessor.getNativeHeader("X-Authorization"); |
|
|
|
|
|
|
|
if (authorization == null || authorization.isEmpty()) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
String accessToken = authorization.get(0); |
|
|
|
if (accessor!=null && StompCommand.CONNECT.equals(accessor.getCommand())) { |
|
|
|
List<String> authorization = accessor.getNativeHeader("Authorization"); |
|
|
|
String accessToken = authorization != null ? authorization.get(0).split(" ")[1] : ""; |
|
|
|
Jwt jwt = jwtDecoder.decode(accessToken); |
|
|
|
JwtAuthenticationConverter converter = new JwtAuthenticationConverter(); |
|
|
|
Authentication authentication = converter.convert(jwt); |
|
|
|