Skip to content

Conform to and respect GDPR middleware #2

Open
@rschindhelm

Description

@rschindhelm

Currently the tag helper disrespects the GDPR middleware by setting the language cookie via JavaScript. The cookie should be set via Response.Cookies.Append instead in order to get processed by the middleware.

Also, we should mark the cookie as essential to ensure it can be set even if the user hasn't given his consensus yet.

This change will ultimately result in the same behavior as if the cookie was set in JavaScript, but the GDPR policies might change in future, so it's presumably better to stay on the safe side.

To extend the Localization.StarterWeb example:

Response.Cookies.Append(
    CookieRequestCultureProvider.DefaultCookieName,
    CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)),
    new CookieOptions {
        Expires = DateTimeOffset.UtcNow.AddYears(1),
        IsEssential = true // mark language cookie as essential
    }
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions