我正在尝试了解 Spring Security 的方式antMatcher和andMatchers工作方式。我有以下代码:
http
.antMatcher("/admin")
.authorizeRequests()
.anyRequest().hasRole("user")
.and()
.formLogin();
问题是它根本不需要形成登录,它只是按GET原样打开呼叫permitAll,不需要用户密码。
如果我删除antMatcher并使用andMatchers它就可以了。但我希望能够创建 2 个单独的过滤器链并用它们进行测试。
知道如何使表单登录与antMatcher角色一起使用吗?