diff --git a/web/src/main/java/org/springframework/security/web/csrf/CookieCsrfTokenRepository.java b/web/src/main/java/org/springframework/security/web/csrf/CookieCsrfTokenRepository.java index dd3b447290..dac21d9ea4 100644 --- a/web/src/main/java/org/springframework/security/web/csrf/CookieCsrfTokenRepository.java +++ b/web/src/main/java/org/springframework/security/web/csrf/CookieCsrfTokenRepository.java @@ -171,14 +171,14 @@ public final class CookieCsrfTokenRepository implements CsrfTokenRepository { } /** - * Factory method to conveniently create an instance that has - * {@link #setCookieHttpOnly(boolean)} set to false. - * @return an instance of CookieCsrfTokenRepository with - * {@link #setCookieHttpOnly(boolean)} set to false + * Factory method to conveniently create an instance that creates cookies where + * {@link Cookie#isHttpOnly()} is set to false. + * @return an instance of CookieCsrfTokenRepository that creates cookies where + * {@link Cookie#isHttpOnly()} is set to false. */ public static CookieCsrfTokenRepository withHttpOnlyFalse() { CookieCsrfTokenRepository result = new CookieCsrfTokenRepository(); - result.setCookieHttpOnly(false); + result.setCookieCustomizer((cookie) -> cookie.httpOnly(false)); return result; } diff --git a/web/src/main/java/org/springframework/security/web/server/csrf/CookieServerCsrfTokenRepository.java b/web/src/main/java/org/springframework/security/web/server/csrf/CookieServerCsrfTokenRepository.java index fcce394733..40301e5de7 100644 --- a/web/src/main/java/org/springframework/security/web/server/csrf/CookieServerCsrfTokenRepository.java +++ b/web/src/main/java/org/springframework/security/web/server/csrf/CookieServerCsrfTokenRepository.java @@ -77,14 +77,14 @@ public final class CookieServerCsrfTokenRepository implements ServerCsrfTokenRep } /** - * Factory method to conveniently create an instance that has - * {@link #setCookieHttpOnly(boolean)} set to false. - * @return an instance of CookieCsrfTokenRepository with - * {@link #setCookieHttpOnly(boolean)} set to false + * Factory method to conveniently create an instance that has creates cookies with + * {@link ResponseCookie#isHttpOnly} set to false. + * @return an instance of CookieCsrfTokenRepository that creates cookies with + * {@link ResponseCookie#isHttpOnly} set to false */ public static CookieServerCsrfTokenRepository withHttpOnlyFalse() { CookieServerCsrfTokenRepository result = new CookieServerCsrfTokenRepository(); - result.setCookieHttpOnly(false); + result.setCookieCustomizer((cookie) -> cookie.httpOnly(false)); return result; }