Message payload can no longer be set. MessageTransformer's transform() method now returns a Message (instead of void). ChannelInterceptor preSend() and postReceive() methods now return a Message instead of boolean.
This commit is contained in:
@@ -27,7 +27,7 @@ import org.springframework.security.context.SecurityContext;
|
||||
import org.springframework.security.context.SecurityContextHolder;
|
||||
|
||||
/**
|
||||
* Propagates the {@ link SecurityContext} associated with the current thread
|
||||
* Propagates the {@link SecurityContext} associated with the current thread
|
||||
* (if any) by adding it to the header of sent messages.
|
||||
*
|
||||
* @author Jonas Partner
|
||||
@@ -36,10 +36,11 @@ public class SecurityContextPropagatingChannelInterceptor extends ChannelInterce
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
|
||||
@Override
|
||||
public boolean preSend(Message<?> message, MessageChannel channel) {
|
||||
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
||||
this.setSecurityContextAttribute(message);
|
||||
return true;
|
||||
return message;
|
||||
}
|
||||
|
||||
protected void setSecurityContextAttribute(Message<?> message) {
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Delegates to the provided instance of {@link AccessDecisionManager} to
|
||||
* enforce the security on the send and receive calls on the {@ MessageChannel}.
|
||||
* enforce the security on the send and receive calls of the {@link MessageChannel}.
|
||||
*
|
||||
* @author Jonas Partner
|
||||
*/
|
||||
@@ -38,11 +38,13 @@ public class SecurityEnforcingChannelInterceptor extends ChannelInterceptorAdapt
|
||||
|
||||
private volatile ConfigAttributeDefinition receiveSecurityAttributes;
|
||||
|
||||
|
||||
public SecurityEnforcingChannelInterceptor(AccessDecisionManager accessDecisionManager) {
|
||||
Assert.notNull(accessDecisionManager, "AccessDecisionManager must not be null");
|
||||
this.accessDecisionManger = accessDecisionManager;
|
||||
}
|
||||
|
||||
|
||||
public ConfigAttributeDefinition getSendSecurityAttributes() {
|
||||
return this.sendSecurityAttributes;
|
||||
}
|
||||
@@ -60,9 +62,9 @@ public class SecurityEnforcingChannelInterceptor extends ChannelInterceptorAdapt
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preSend(Message<?> message, MessageChannel channel) {
|
||||
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
||||
this.checkSend(channel);
|
||||
return true;
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user