Updates Culture and Visitor cookies to use "Lax" SameSite and Secure cookie options
This commit is contained in:
parent
b4506f1133
commit
ffa0ca9379
|
@ -429,7 +429,10 @@
|
|||
new CookieOptions()
|
||||
{
|
||||
Expires = DateTimeOffset.UtcNow.AddYears(10),
|
||||
IsEssential = true
|
||||
IsEssential = true,
|
||||
SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Lax, // Set SameSite attribute
|
||||
Secure = true, // Ensure the cookie is only sent over HTTPS
|
||||
HttpOnly = true // Optional: Helps mitigate XSS attacks
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -601,9 +604,19 @@
|
|||
|
||||
private void SetLocalizationCookie(string culture)
|
||||
{
|
||||
var cookieOptions = new Microsoft.AspNetCore.Http.CookieOptions
|
||||
{
|
||||
Expires = DateTimeOffset.UtcNow.AddYears(1),
|
||||
SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Lax, // Set SameSite attribute
|
||||
Secure = true, // Ensure the cookie is only sent over HTTPS
|
||||
HttpOnly = true // Optional: Helps mitigate XSS attacks
|
||||
};
|
||||
|
||||
Context.Response.Cookies.Append(
|
||||
CookieRequestCultureProvider.DefaultCookieName,
|
||||
CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)));
|
||||
CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)),
|
||||
cookieOptions
|
||||
);
|
||||
}
|
||||
|
||||
private async Task<List<Resource>> GetPageResources(Alias alias, Site site, Page page, List<Module> modules, int moduleid, string action)
|
||||
|
|
Loading…
Reference in New Issue
Block a user