Xsrf cookie for CORS

This commit is contained in:
MathewFrancis 2025-06-10 17:26:59 +05:30
parent c8575e0b11
commit 3799e416e8
3 changed files with 7 additions and 3 deletions

View File

@ -10,8 +10,8 @@ export async function createEndpointHttpEeq(inputForm = {}) {
//body: JSON.stringify(inputForm),
credentials: "include", //This sends cookies (even HTTP-only ones)
});
// const xsrf_json_resp = await xsrf.json();
console.log(xsrf);
const xsrf_json_resp = await xsrf.json();
console.log(xsrf_json_resp);
// const response = await fetch(`${socket}/cezen/add_user`, {
// method: "POST",

View File

@ -37,7 +37,11 @@ public class CezenLoginSecurityChain {
//CSRF cookie
final CookieCsrfTokenRepository cookieCsrfTokenRepo = new CookieCsrfTokenRepository();
//make secure true when using only https
cookieCsrfTokenRepo.setCookieCustomizer(responseCookieBuilder -> responseCookieBuilder.secure(false));
cookieCsrfTokenRepo.setCookieCustomizer(responseCookieBuilder -> {
responseCookieBuilder.secure(true);
responseCookieBuilder.sameSite("None");
responseCookieBuilder.build();
});
// bellow line is used when you are using JWT tokens instead of jSession session keys but i put always because i guess CSRF token needs it
http.