How to reject topic subscription based on user rights with Spring-websocket

后端 未结 2 1157
再見小時候
再見小時候 2020-12-12 21:15

I\'m implementing a version of the stock application where the server able to reject topic subscription for certain topic based on the user rights. Is there a way in spring

2条回答
  •  无人及你
    2020-12-12 21:23

    As of Spring 5.x the correct method to override to attach the interceptor, if you're extending AbstractSecurityWebSocketMessageBrokerConfigurer, is customizeClientInboundChannel:

    @Override
    public void customizeClientInboundChannel(ChannelRegistration registration) {
        registration.interceptors(new TopicSubscriptionInterceptor());
    }
    

提交回复
热议问题