这是我的本地主机登录网址,我想许可该页面.. 所以我像这样验证了该网址 public SecurityFilterChain securityFilterChain(HttpSecurity http) 抛出异常 { http .authorizeHttpRequests(请求 -> request.requestMatchers("/login") .permitAll() .anyRequest().authenticated() ); 返回 http.build(); } 我只想授予登录页面权限,但结果是 403 禁止错误 我能做什么来解决这个问题??
我想访问登录页面,但无法修复它?
要使用requestMatchers(),您可以阅读https://docs.spring.io/spring-security/reference/5.8/migration/servlet/config.html#use-new-requestmatchers,您将看到如何做到这一点:
http
.authorizeHttpRequests(
request -> request.requestMatchers("/login/**")
.permitAll()
.anyRequest()
.authenticated();