Spring websocket with stomp security - every user can subscribe to any other users queue?

荒凉一梦 提交于 2019-12-03 14:43:32
Alessandro Polverini

Check this similar question: you have to authenticate the user via HTTP using Spring Security, and then send message to users using the SimpMessageTemplate.convertAndSendToUser() method.

You can take two options.

  1. Simply remove "/user/" from config.enableStompBrokerRelay. Spring message will automatically prefix.

    convertAndSendToUser is not for broker relay.

See org.springframework.messaging.simp.user packages source



Default user prefix is '/user/'. You can change it with config.setUserDestinationPrefix()





2. Override two methods and handle it from ChannelInterceptor

Methods:

  • configureClientInboundChannel
  • configureClientOutboundChannel
  • 易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!