-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to manage who is consuming from specific queue? #69
Comments
And you are aware that Spring Security already has this feautre? http://docs.spring.io/spring-security/site/docs/current/reference/html/websocket.html |
Thank you for your quick response. I just get to know that feature. Unfortunately I still can't find my solution. After a subscription is filtered only for any principal that has role 'USER', I need to add additional step, to make sure one to one relationship between queue and user . Let's take an example, subscription is success if the destination contains the username that is being subscribed to achieve specific queue per user and allow only specific user accordingly. Here is the illustration: @Override
protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) {
messages
.nullDestMatcher().authenticated()
.simpDestMatchers("/queueu/**").hasRole("USER").addInterceptor(
new MessageSubscriptionInterceptor(){
public void intercept(SessionSubscribeEvent subscription, WebSocketHandler wsHandler, Principal principal, Map<String, Object> attributes){
final String destination = (String) subscription.getMessage().getHeaders().get("destination");
if(!destination.contains(principal.getName().toLowerCase())){
subscription.cancel("UNAUTHORIZED ACCESS!");
}
}
}
)
.simpTypeMatchers(MESSAGE, SUBSCRIBE).denyAll()
.anyMessage().denyAll();
} Anyway, thank you. Spring team makes developer's life easier. |
Regarding your need "additional step, to make sure one to one relationship between queue and user", I originally thought our product needed to enforce one to one, in order to avoid
|
Dear @rstoyanchev , I created something like "How not to use SockJS". Now I need to create 'Authorization' feature so that user A can only subscribed into '/amq/queue/user.a', and user B can only subscribed into '/amq/queue/user.b' identified by 'access_token' upon handshake.
I tried to play around with
ApplicationListener<SessionSubscribeEvent>
and tried to implement whatStompSubProtocolHandler.afterSessionEnded()
did yet still no luck. It is based on stupid guess actually. Could you please give me pointer?Executing this code:
Got NPE:
Thanks in advance.
The text was updated successfully, but these errors were encountered: