【发布时间】:2020-02-27 16:12:12
【问题描述】:
我使用的是 spring-security 5.2,在配置中我写了以下http.csrf().disable().authorizeRequests()
.antMatchers("/login*", "/js/**", "/css/**", "/vendors/**", "/images/**").permitAll()
.antMatchers("/**").authenticated();
应用程序 url 类似于http://localhost:8080/myApp 问题是当我调用应用程序 url 时,不会调用身份验证入口点。
仅当我将最后一行修改为 .antMatchers("/main*").authenticated();然后拨打http://localhost:8080/myApp/main一切正常。
我正在使用 Keycloak Spring Security Adapter 配置 Keycloak SSO 服务器 (7.0.1) +。所以我想知道,为什么在 .antMatchers("/**").authenticated() 的情况下没有调用 Keycloak 入口点,并且只有在我写了类似 .antMatchers("/main*").authenticated( )。
谁能解释我的原始代码有什么问题?
谢谢
【问题讨论】:
-
配置
.antMatchers("/**").authenticated();将毫无疑问地将访问/重定向到/login。参考Help others reproduce the problem section
标签: spring-security