Add user to DISCONNECT in StompSubProtocolHandler
Issue: SPR-12215
This commit is contained in:
parent
b1e9577680
commit
4af9851585
|
|
@ -469,6 +469,7 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
|
|||
}
|
||||
headerAccessor.setSessionId(session.getId());
|
||||
headerAccessor.setSessionAttributes(session.getAttributes());
|
||||
headerAccessor.setUser(session.getPrincipal());
|
||||
return MessageBuilder.createMessage(EMPTY_PAYLOAD, headerAccessor.getMessageHeaders());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -207,13 +207,7 @@ public class StompSubProtocolHandlerTests {
|
|||
@Test
|
||||
public void eventPublicationWithExceptions() {
|
||||
|
||||
ApplicationEventPublisher publisher = new ApplicationEventPublisher() {
|
||||
|
||||
@Override
|
||||
public void publishEvent(ApplicationEvent event) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
};
|
||||
ApplicationEventPublisher publisher = mock(ApplicationEventPublisher.class);
|
||||
|
||||
UserSessionRegistry registry = new DefaultUserSessionRegistry();
|
||||
this.protocolHandler.setUserSessionRegistry(registry);
|
||||
|
|
@ -244,7 +238,10 @@ public class StompSubProtocolHandlerTests {
|
|||
verify(this.channel).send(this.messageCaptor.capture());
|
||||
actual = this.messageCaptor.getValue();
|
||||
assertNotNull(actual);
|
||||
assertEquals(StompCommand.DISCONNECT, StompHeaderAccessor.wrap(actual).getCommand());
|
||||
StompHeaderAccessor accessor = StompHeaderAccessor.wrap(actual);
|
||||
assertEquals(StompCommand.DISCONNECT, accessor.getCommand());
|
||||
assertEquals("s1", accessor.getSessionId());
|
||||
assertEquals("joe", accessor.getUser().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue