public final class SecurityContextChannelInterceptor
extends org.springframework.messaging.support.ChannelInterceptorAdapter
implements org.springframework.messaging.support.ExecutorChannelInterceptor
Creates a ExecutorChannelInterceptor that will obtain the
Authentication from the specified Message.getHeaders().
| Constructor and Description |
|---|
SecurityContextChannelInterceptor()
Creates a new instance using the header of the name
SimpMessageHeaderAccessor.USER_HEADER. |
SecurityContextChannelInterceptor(java.lang.String authenticationHeaderName)
Creates a new instance that uses the specified header to obtain the
Authentication. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterMessageHandled(org.springframework.messaging.Message<?> message,
org.springframework.messaging.MessageChannel channel,
org.springframework.messaging.MessageHandler handler,
java.lang.Exception ex) |
void |
afterSendCompletion(org.springframework.messaging.Message<?> message,
org.springframework.messaging.MessageChannel channel,
boolean sent,
java.lang.Exception ex) |
org.springframework.messaging.Message<?> |
beforeHandle(org.springframework.messaging.Message<?> message,
org.springframework.messaging.MessageChannel channel,
org.springframework.messaging.MessageHandler handler) |
org.springframework.messaging.Message<?> |
preSend(org.springframework.messaging.Message<?> message,
org.springframework.messaging.MessageChannel channel) |
void |
setAnonymousAuthentication(Authentication authentication)
Allows setting the Authentication used for anonymous authentication.
|
afterReceiveCompletion, postReceive, postSend, preReceivepublic SecurityContextChannelInterceptor()
SimpMessageHeaderAccessor.USER_HEADER.public SecurityContextChannelInterceptor(java.lang.String authenticationHeaderName)
Authentication.authenticationHeaderName - the header name to obtain the
Authentication. Cannot be null.public void setAnonymousAuthentication(Authentication authentication)
new AnonymousAuthenticationToken("key", "anonymous",
AuthorityUtils.createAuthorityList("ROLE_ANONYMOUS"));
authentication - the Authentication used for anonymous authentication. Cannot
be null.public org.springframework.messaging.Message<?> preSend(org.springframework.messaging.Message<?> message,
org.springframework.messaging.MessageChannel channel)
preSend in interface org.springframework.messaging.support.ChannelInterceptorpreSend in class org.springframework.messaging.support.ChannelInterceptorAdapterpublic void afterSendCompletion(org.springframework.messaging.Message<?> message,
org.springframework.messaging.MessageChannel channel,
boolean sent,
java.lang.Exception ex)
afterSendCompletion in interface org.springframework.messaging.support.ChannelInterceptorafterSendCompletion in class org.springframework.messaging.support.ChannelInterceptorAdapterpublic org.springframework.messaging.Message<?> beforeHandle(org.springframework.messaging.Message<?> message,
org.springframework.messaging.MessageChannel channel,
org.springframework.messaging.MessageHandler handler)
beforeHandle in interface org.springframework.messaging.support.ExecutorChannelInterceptorpublic void afterMessageHandled(org.springframework.messaging.Message<?> message,
org.springframework.messaging.MessageChannel channel,
org.springframework.messaging.MessageHandler handler,
java.lang.Exception ex)
afterMessageHandled in interface org.springframework.messaging.support.ExecutorChannelInterceptor