فهرست منبع

SEC-2832: Update request attributes with new CsrfToken

Stillglade 10 سال پیش
والد
کامیت
aa0a5b96ab
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      web/src/main/java/org/springframework/security/web/csrf/CsrfAuthenticationStrategy.java

+ 3 - 1
web/src/main/java/org/springframework/security/web/csrf/CsrfAuthenticationStrategy.java

@@ -56,6 +56,8 @@ public final class CsrfAuthenticationStrategy implements
             CsrfToken newToken = this.csrfTokenRepository.generateToken(request);
             this.csrfTokenRepository.saveToken(null, request, response);
             this.csrfTokenRepository.saveToken(newToken, request, response);
+            request.setAttribute(CsrfToken.class.getName(), newToken);
+            request.setAttribute(newToken.getParameterName(), newToken);
         }
     }
-}
+}