http.authorizeRequests()。antMatchers(“ /”)。permitAll()不起作用

时间:2019-06-08 02:53:09

标签: spring spring-security

我正在尝试对某些URL进行匿名访问,这是代码:

 @Override
        protected void configure(HttpSecurity http) throws Exception {
            http.authorizeRequests().antMatchers("/","/boutique**","/proprietaires**","/produits**").permitAll()
            .and().authorizeRequests().anyRequest().fullyAuthenticated().and().httpBasic().and().csrf().disable();
        }

但是它仍然会显示“ 401”错误。

有人可以告诉我我所缺少的吗?

1 个答案:

答案 0 :(得分:0)

它必须:antMatchers("/","/boutique/**","/proprietaires/**","/produits/**"。您错过了/