2

我正在使用 Spring Boot 2.2 安全性,以下是我的 Java 配置:

 http.authorizeRequests().anyRequest().authenticated()
                .and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                .and().exceptionHandling().authenticationEntryPoint(authenticationFailureHandler)
                .and().exceptionHandling().accessDeniedHandler(accessDeniedHandler)
.and().httpBasic()
.and().csrf().requireCsrfProtectionMatcher(csrfRequestMatcher)
                .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());

我在响应标头中看到 XSRF-TOKEN 的 2 个 set-cookie,如下所示。不知道为什么。

设置cookie:XSRF-TOKEN=;最大年龄=0;到期时间=周四,1970 年 1 月 1 日 00:00:10 GMT;路径=/隐藏

设置cookie:XSRF-TOKEN = 5564cfc1-884d-4b89-9bb9-11a92f42bcc7;路径=/隐藏

我在这里想念什么?Spring 安全性相对较新。

4

0 回答 0