Как мне указать {id} в requestMatchers?
Вот код:
@Bean
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
return http
.authorizeHttpRequests(auth -> auth
.requestMatchers("/", "/files/[0-9]+", "/box/[0-9]+", "/registration", "/hello")
.permitAll()
.anyRequest().authenticated())
.formLogin(form -> form.loginPage("/login").permitAll()
.successHandler(new SavedRequestAwareAuthenticationSuccessHandler()).permitAll()
.defaultSuccessUrl("/").permitAll())
.logout(logout -> logout.logoutSuccessUrl("/").permitAll())
.build();
}
"/files/[0-9]+"
, "/box/[0-9]+"
не работают.
Пробовал "/files/**"
, "/box/*"
и т. д. — не подходит, т. к. есть и другие пути от /box/
. К примеру, /box/create
и т. д.