Skip to content

Consent Models & GPC

The consent resolver determines if a user has consented to a cookie category:

public interface IConsentResolver
{
Task<bool> HasConsentAsync(HttpContext httpContext, CookieCategory category);
}

StrictlyNecessary cookies bypass consent checks entirely — the cookie manager never calls HasConsentAsync for essential cookies.

The cookie system supports four consent models, configured per tenant via the regulation profile:

ModelBehaviorRegulation
OptInCookies blocked until explicit consentGDPR, LGPD
OptOutCookies allowed by default, blocked on explicit opt-outCCPA
HybridOptIn for sensitive categories, OptOut for non-sensitiveSome US states
NoneNo specific consent requirementJurisdictions without cookie law

The consent model is resolved via ICookieConsentModelProvider — an optional interface provided by the bridge package Granit.Privacy.Regulations.Cookies.

The GPC signal (Sec-GPC: 1 HTTP header) indicates the user prefers not to have their data sold or shared.

IGlobalPrivacyControlSignal detects the header. The GranitCookieManager suppresses cookies based on the consent model:

Consent modelGPC activeEffect
OptOut (CCPA)YesSuppress SaleOrSharing + Marketing only
OptIn (GDPR)YesSuppress ALL non-essential categories
HybridYesSuppress SaleOrSharing + Marketing only
AnyNoNo effect — fall through to IConsentResolver
ImplementationBehavior
NullConsentResolverDenies consent for all non-essential categories (default)
NullCookieConsentModelProviderReturns null — no GPC suppression (default)
GlobalPrivacyControlHeaderSignalReads Sec-GPC: 1 header (always registered)