Merge branch '5.8.x' into 6.1.x

Closes gh-14921
This commit is contained in:
Josh Cummings 2024-04-17 16:44:50 -06:00
commit ade45771b2
No known key found for this signature in database
GPG Key ID: A306A51F43B8E5A5
1 changed files with 6 additions and 2 deletions

View File

@ -68,7 +68,7 @@ public final class RequestMatcherDelegatingAuthorizationManager implements Autho
@Override @Override
public AuthorizationDecision check(Supplier<Authentication> authentication, HttpServletRequest request) { public AuthorizationDecision check(Supplier<Authentication> authentication, HttpServletRequest request) {
if (this.logger.isTraceEnabled()) { if (this.logger.isTraceEnabled()) {
this.logger.trace(LogMessage.format("Authorizing %s", request)); this.logger.trace(LogMessage.format("Authorizing %s", requestLine(request)));
} }
for (RequestMatcherEntry<AuthorizationManager<RequestAuthorizationContext>> mapping : this.mappings) { for (RequestMatcherEntry<AuthorizationManager<RequestAuthorizationContext>> mapping : this.mappings) {
@ -77,7 +77,7 @@ public final class RequestMatcherDelegatingAuthorizationManager implements Autho
if (matchResult.isMatch()) { if (matchResult.isMatch()) {
AuthorizationManager<RequestAuthorizationContext> manager = mapping.getEntry(); AuthorizationManager<RequestAuthorizationContext> manager = mapping.getEntry();
if (this.logger.isTraceEnabled()) { if (this.logger.isTraceEnabled()) {
this.logger.trace(LogMessage.format("Checking authorization on %s using %s", request, manager)); this.logger.trace(LogMessage.format("Checking authorization on %s using %s", requestLine(request), manager));
} }
return manager.check(authentication, return manager.check(authentication,
new RequestAuthorizationContext(request, matchResult.getVariables())); new RequestAuthorizationContext(request, matchResult.getVariables()));
@ -89,6 +89,10 @@ public final class RequestMatcherDelegatingAuthorizationManager implements Autho
return DENY; return DENY;
} }
private static String requestLine(HttpServletRequest request) {
return request.getMethod() + " " + UrlUtils.buildRequestUrl(request);
}
/** /**
* Creates a builder for {@link RequestMatcherDelegatingAuthorizationManager}. * Creates a builder for {@link RequestMatcherDelegatingAuthorizationManager}.
* @return the new {@link Builder} instance * @return the new {@link Builder} instance