相关疑难解决方法(0)

具有多个路径的spring security http antMatcher

我有以下spring security java配置规则(版本3.2.4),它有效:

http.antMatcher("/lti1p/**")
    .addFilterBefore(ltioAuthProviderProcessingFilter, UsernamePasswordAuthenticationFilter.class)
    .authorizeRequests().anyRequest().hasRole("LTI")
    .and().csrf().disable();
Run Code Online (Sandbox Code Playgroud)

但是,我想将此规则应用于2个路径("/ lti1p/"和("/ lti2p / ").我不能只用antMatcher替换antMatcher(HttpSecurity对象不允许),当我尝试某些东西时像这样它不再正确地应用规则.

http
    .addFilterBefore(ltioAuthProviderProcessingFilter, UsernamePasswordAuthenticationFilter.class)
    .authorizeRequests()
    .antMatchers("/lti1p/**","/lti2p/**").hasRole("LTI")
    .and().csrf().disable();
Run Code Online (Sandbox Code Playgroud)

我试过了很多变种而没有任何运气.有没有人知道使用java配置将此规则应用于多个路径的正确方法?

spring spring-security

21
推荐指数
1
解决办法
3万
查看次数

标签 统计

spring ×1

spring-security ×1