-
Notifications
You must be signed in to change notification settings - Fork 6.1k
RequestMatcherDelegatingWebInvocationPrivilegeEvaluator fails with PathPatternRequestMatcher #16771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In this way PathPatternRequestMatcher won't need to reparse for each request matcher. Issue gh-16771
Maybe not exactly the same issue, but I still get a failure in 6.5.0 when using StackTrace
A simple test case that reproduces the problem @SpringJUnitWebConfig
@ContextConfiguration(classes = MyTest.TestConfig.class)
public class MyTest {
@Autowired
WebInvocationPrivilegeEvaluator evaluator;
@Test
void testWebInvocationPrivilegeEvaluator() {
evaluator.isAllowed("/admin", new UsernamePasswordAuthenticationToken(
"user", "password", List.of()));
}
@Configuration
@EnableWebSecurity
public static class TestConfig {
@Bean
public SecurityFilterChain testingFilterChain(HttpSecurity http)
throws Exception {
var matcherBuilder = PathPatternRequestMatcher.withDefaults();
http.authorizeHttpRequests(cfg -> cfg
.requestMatchers(matcherBuilder.matcher("/admin/**"))
.hasRole("ADMIN")
.requestMatchers(matcherBuilder.matcher("/public/**"))
.permitAll());
return http.build();
}
}
} EDIT: perhaps is just an issue in the test setup; exposing |
When using
WebInvocationPrivilegeEvaluator(e.g. Theymeleaf Security or JSP Taglibs) with PathPatternRequestMatcher it fails with the following exception:
The text was updated successfully, but these errors were encountered: