Polish AuthorizationManager#authorize
Issue gh-14843
This commit is contained in:
@@ -67,11 +67,11 @@ public final class AuthorizationChannelInterceptor implements ChannelInterceptor
|
||||
@Override
|
||||
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
||||
this.logger.debug(LogMessage.of(() -> "Authorizing message send"));
|
||||
AuthorizationResult decision = this.preSendAuthorizationManager.authorize(this.authentication, message);
|
||||
this.eventPublisher.publishAuthorizationEvent(this.authentication, message, decision);
|
||||
if (decision == null || !decision.isGranted()) { // default deny
|
||||
AuthorizationResult result = this.preSendAuthorizationManager.authorize(this.authentication, message);
|
||||
this.eventPublisher.publishAuthorizationEvent(this.authentication, message, result);
|
||||
if (result == null || !result.isGranted()) { // default deny
|
||||
this.logger.debug(LogMessage.of(() -> "Failed to authorize message with authorization manager "
|
||||
+ this.preSendAuthorizationManager + " and decision " + decision));
|
||||
+ this.preSendAuthorizationManager + " and result " + result));
|
||||
throw new AccessDeniedException("Access Denied");
|
||||
}
|
||||
this.logger.debug(LogMessage.of(() -> "Authorized message send"));
|
||||
@@ -118,6 +118,7 @@ public final class AuthorizationChannelInterceptor implements ChannelInterceptor
|
||||
@Override
|
||||
public <T> void publishAuthorizationEvent(Supplier<Authentication> authentication, T object,
|
||||
AuthorizationResult result) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,7 +60,9 @@ public final class MessageMatcherDelegatingAuthorizationManager implements Autho
|
||||
* @return an {@link AuthorizationDecision}. If there is no {@link MessageMatcher}
|
||||
* matching the message, or the {@link AuthorizationManager} could not decide, then
|
||||
* null is returned
|
||||
* @deprecated please use {@link #authorize(Supplier, Object)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public AuthorizationDecision check(Supplier<Authentication> authentication, Message<?> message) {
|
||||
if (this.logger.isTraceEnabled()) {
|
||||
|
||||
Reference in New Issue
Block a user