Class SecurityContextPropagationChannelInterceptor

java.lang.Object
org.springframework.integration.channel.interceptor.ThreadStatePropagationChannelInterceptor<org.springframework.security.core.Authentication>
org.springframework.integration.security.channel.SecurityContextPropagationChannelInterceptor
All Implemented Interfaces:
org.springframework.messaging.support.ChannelInterceptor, org.springframework.messaging.support.ExecutorChannelInterceptor

public class SecurityContextPropagationChannelInterceptor
extends org.springframework.integration.channel.interceptor.ThreadStatePropagationChannelInterceptor<org.springframework.security.core.Authentication>
The ExecutorChannelInterceptor implementation responsible for the SecurityContext propagation from one message flow's thread to another through the MessageChannels involved in the flow.

In addition this interceptor cleans up (restores) the SecurityContext in the containers Threads for channels like ExecutorChannel and QueueChannel.

Since:
4.2
See Also:
ThreadStatePropagationChannelInterceptor
  • Constructor Summary

    Constructors 
    Constructor Description
    SecurityContextPropagationChannelInterceptor()  
  • Method Summary

    Modifier and Type Method Description
    void afterMessageHandled​(org.springframework.messaging.Message<?> message, org.springframework.messaging.MessageChannel channel, org.springframework.messaging.MessageHandler handler, java.lang.Exception ex)  
    protected org.springframework.security.core.Authentication obtainPropagatingContext​(org.springframework.messaging.Message<?> message, org.springframework.messaging.MessageChannel channel)  
    protected void populatePropagatedContext​(org.springframework.security.core.Authentication authentication, org.springframework.messaging.Message<?> message, org.springframework.messaging.MessageChannel channel)  

    Methods inherited from class org.springframework.integration.channel.interceptor.ThreadStatePropagationChannelInterceptor

    beforeHandle, postReceive, preSend

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.messaging.support.ChannelInterceptor

    afterReceiveCompletion, afterSendCompletion, postSend, preReceive
  • Constructor Details

  • Method Details

    • afterMessageHandled

      public void afterMessageHandled​(org.springframework.messaging.Message<?> message, org.springframework.messaging.MessageChannel channel, org.springframework.messaging.MessageHandler handler, java.lang.Exception ex)
      Specified by:
      afterMessageHandled in interface org.springframework.messaging.support.ExecutorChannelInterceptor
      Overrides:
      afterMessageHandled in class org.springframework.integration.channel.interceptor.ThreadStatePropagationChannelInterceptor<org.springframework.security.core.Authentication>
    • obtainPropagatingContext

      protected org.springframework.security.core.Authentication obtainPropagatingContext​(org.springframework.messaging.Message<?> message, org.springframework.messaging.MessageChannel channel)
      Specified by:
      obtainPropagatingContext in class org.springframework.integration.channel.interceptor.ThreadStatePropagationChannelInterceptor<org.springframework.security.core.Authentication>
    • populatePropagatedContext

      protected void populatePropagatedContext​(org.springframework.security.core.Authentication authentication, org.springframework.messaging.Message<?> message, org.springframework.messaging.MessageChannel channel)
      Specified by:
      populatePropagatedContext in class org.springframework.integration.channel.interceptor.ThreadStatePropagationChannelInterceptor<org.springframework.security.core.Authentication>