Фильтровать в SpringSecurityWebAppConfig - PullRequest
0 голосов
/ 13 апреля 2020

Я хотел бы спросить, возможно ли вообще фильтровать по v1/library/**/shelf

Мой фактический вызов будет выглядеть примерно так: v1/library/213/shelf. 213 будет как номер комнаты.

@Configuration
@EnableWebSecurity
public class SpringSecurityWebAppConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    public JwtAuthenticationFilter jwtAuthenticationFilter;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .csrf()
                    .disable()
                .exceptionHandling()
                    .authenticationEntryPoint(new CustomAuthenticationEntryPoint())
                    .and()
                .sessionManagement()
                    .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                    .and()
                .addFilterAfter(jwtAuthenticationFilter, BasicAuthenticationFilter.class)
                .authorizeRequests()
                    .antMatchers(HttpMethod.POST, "/v1/library/**/shelf").access("hasRole('ROLE_READER')")
                    .and()
                .headers()
                    .httpStrictTransportSecurity()
                    .includeSubDomains(true).maxAgeInSeconds(31536000);
    }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...