Fix setServletContext not being called for AuthorizationManagerWebInvocationPrivilegeEvaluator

Issue gh-10908
This commit is contained in:
Marcus Da Coregio 2022-04-25 09:38:58 -03:00
parent 97acbcc2d0
commit 23594b3d01
1 changed files with 4 additions and 1 deletions

View File

@ -357,7 +357,10 @@ public final class WebSecurity extends AbstractConfiguredSecurityBuilder<Filter,
if (filter instanceof AuthorizationFilter) { if (filter instanceof AuthorizationFilter) {
AuthorizationManager<HttpServletRequest> authorizationManager = ((AuthorizationFilter) filter) AuthorizationManager<HttpServletRequest> authorizationManager = ((AuthorizationFilter) filter)
.getAuthorizationManager(); .getAuthorizationManager();
privilegeEvaluators.add(new AuthorizationManagerWebInvocationPrivilegeEvaluator(authorizationManager)); AuthorizationManagerWebInvocationPrivilegeEvaluator evaluator = new AuthorizationManagerWebInvocationPrivilegeEvaluator(
authorizationManager);
evaluator.setServletContext(this.servletContext);
privilegeEvaluators.add(evaluator);
} }
} }
return new RequestMatcherEntry<>(securityFilterChain::matches, privilegeEvaluators); return new RequestMatcherEntry<>(securityFilterChain::matches, privilegeEvaluators);