public final class SecurityContextChannelInterceptor
extends ChannelInterceptorAdapter
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(<any> message,
MessageChannel channel,
MessageHandler handler,
java.lang.Exception ex) |
void |
afterSendCompletion(<any> message,
MessageChannel channel,
boolean sent,
java.lang.Exception ex) |
<any> |
beforeHandle(<any> message,
MessageChannel channel,
MessageHandler handler) |
<any> |
preSend(<any> message,
MessageChannel channel) |
void |
setAnonymousAuthentication(Authentication authentication)
Allows setting the Authentication used for anonymous authentication.
|
public 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 <any> preSend(<any> message, MessageChannel channel)
public void afterSendCompletion(<any> message, MessageChannel channel, boolean sent, java.lang.Exception ex)
public <any> beforeHandle(<any> message, MessageChannel channel, MessageHandler handler)
public void afterMessageHandled(<any> message, MessageChannel channel, MessageHandler handler, java.lang.Exception ex)