Documentation
¶
Index ¶
- Variables
- func EnforceGDPR(signal Signal, defaultValue Signal, channelEnabled bool) bool
- func FetchLatestGVLVendorIDs(ctx context.Context, client *http.Client, urlMaker func(uint16, uint16) string, ...) map[uint16]struct{}
- func GetConsent(req *openrtb_ext.RequestWrapper, gpp gpplib.GppContainer) (consent string)
- func NewGVLVendorIDTickerTask(interval time.Duration, client *http.Client, ...) *task.TickerTask
- func SelectEEACountries(hostEEACountries []string, accountEEACountries []string) []string
- func VendorListURLMaker(specVersion, listVersion uint16) string
- type AllowHostCookies
- func (p AllowHostCookies) AuctionActivitiesAllowed(ctx context.Context, bidderCoreName openrtb_ext.BidderName, ...) AuctionPermissions
- func (p AllowHostCookies) BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.BidderName) (bool, error)
- func (p *AllowHostCookies) HostCookiesAllowed(ctx context.Context) (bool, error)
- type AlwaysAllow
- func (a AlwaysAllow) AuctionActivitiesAllowed(ctx context.Context, bidderCoreName openrtb_ext.BidderName, ...) AuctionPermissions
- func (a AlwaysAllow) BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.BidderName) (bool, error)
- func (a AlwaysAllow) HostCookiesAllowed(ctx context.Context) (bool, error)
- type AuctionPermissions
- type BasicEnforcement
- type BidderInfo
- type ErrorMalformedConsent
- type FullEnforcement
- type LiveGVLVendorIDs
- type Overrides
- type Permissions
- type PermissionsBuilder
- type PurposeEnforcer
- type PurposeEnforcerBuilder
- type PurposeEnforcers
- type RequestInfo
- type Signal
- func GetGDPR(req *openrtb_ext.RequestWrapper) (Signal, error)
- func IntSignalParse(i int) (Signal, error)
- func ParseGDPRDefaultValue(r *openrtb_ext.RequestWrapper, cfgDefault string, eeaCountries []string) Signal
- func SignalNormalize(signal Signal, gdprDefaultValue string) Signal
- func StrSignalParse(signal string) (Signal, error)
- type TCF2ConfigBuilder
- type TCF2ConfigReader
- type VendorInfo
- type VendorListFetcher
Constants ¶
This section is empty.
Variables ¶
var AllowAll = AuctionPermissions{ AllowBidRequest: true, PassGeo: true, PassID: true, }
var AllowBidRequestOnly = AuctionPermissions{ AllowBidRequest: true, PassGeo: false, PassID: false, }
var DenyAll = AuctionPermissions{ AllowBidRequest: false, PassGeo: false, PassID: false, }
Functions ¶
func EnforceGDPR ¶
EnforceGDPR determines if GDPR should be enforced based on the request signal and whether the channel is enabled
func FetchLatestGVLVendorIDs ¶
func FetchLatestGVLVendorIDs(ctx context.Context, client *http.Client, urlMaker func(uint16, uint16) string, me metrics.MetricsEngine) map[uint16]struct{}
FetchLatestGVLVendorIDs fetches the most recent Global Vendor List and returns a set of all vendor IDs present in it. The returned map has vendor IDs as keys and empty structs as values. If the fetch or parse fails, an empty map is returned.
func GetConsent ¶
func GetConsent(req *openrtb_ext.RequestWrapper, gpp gpplib.GppContainer) (consent string)
GetConsent will pull the consent string from an openrtb request
func NewGVLVendorIDTickerTask ¶
func NewGVLVendorIDTickerTask(interval time.Duration, client *http.Client, urlMaker func(uint16, uint16) string, live *LiveGVLVendorIDs, me metrics.MetricsEngine) *task.TickerTask
NewGVLVendorIDTickerTask creates a TickerTask that fetches the latest GVL vendor IDs and updates the LiveGVLVendorIDs set. Calling Start on the returned task performs the initial fetch immediately and then schedules periodic refreshes at the given interval.
func SelectEEACountries ¶
SelectEEACountries selects the EEA countries based on host and account configurations. Account-level configuration takes precedence over the host-level configuration.
func VendorListURLMaker ¶
Make a URL which can be used to fetch a given version of the Global Vendor List. If the version is 0, this will fetch the latest version.
Types ¶
type AllowHostCookies ¶
type AllowHostCookies struct {
// contains filtered or unexported fields
}
AllowHostCookies represents a GDPR permissions policy with host cookie syncing always allowed
func (AllowHostCookies) AuctionActivitiesAllowed ¶
func (p AllowHostCookies) AuctionActivitiesAllowed(ctx context.Context, bidderCoreName openrtb_ext.BidderName, bidder openrtb_ext.BidderName) AuctionPermissions
AuctionActivitiesAllowed determines whether auction activities are permitted for a given bidder
func (AllowHostCookies) BidderSyncAllowed ¶
func (p AllowHostCookies) BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.BidderName) (bool, error)
BidderSyncAllowed determines whether a given bidder is allowed to perform a cookie sync
func (*AllowHostCookies) HostCookiesAllowed ¶
func (p *AllowHostCookies) HostCookiesAllowed(ctx context.Context) (bool, error)
HostCookiesAllowed always returns true
type AlwaysAllow ¶
type AlwaysAllow struct{}
Exporting to allow for easy test setups
func (AlwaysAllow) AuctionActivitiesAllowed ¶
func (a AlwaysAllow) AuctionActivitiesAllowed(ctx context.Context, bidderCoreName openrtb_ext.BidderName, bidder openrtb_ext.BidderName) AuctionPermissions
func (AlwaysAllow) BidderSyncAllowed ¶
func (a AlwaysAllow) BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.BidderName) (bool, error)
func (AlwaysAllow) HostCookiesAllowed ¶
func (a AlwaysAllow) HostCookiesAllowed(ctx context.Context) (bool, error)
type AuctionPermissions ¶
type BasicEnforcement ¶
type BasicEnforcement struct {
// contains filtered or unexported fields
}
BasicEnforcement determines if legal basis is satisfied for a given purpose and bidder/analytics adapter using the TCF2 basic enforcement algorithm. The algorithm is a high-level mode of consent confirmation that looks for a good-faith indication that the user has provided consent or legal basis signals necessary to perform a privacy-protected activity. The algorithm does not involve the GVL. BasicEnforcement implements the PurposeEnforcer interface
func (*BasicEnforcement) LegalBasis ¶
func (be *BasicEnforcement) LegalBasis(vendorInfo VendorInfo, name string, consent tcf2.ConsentMetadata, overrides Overrides) bool
LegalBasis determines if legal basis is satisfied for a given purpose and bidder/analytics adapter based on user consent and legal basis signals.
type BidderInfo ¶
type BidderInfo struct {
// contains filtered or unexported fields
}
type ErrorMalformedConsent ¶
An ErrorMalformedConsent will be returned by the Permissions interface if the consent string argument was the reason for the failure.
func (*ErrorMalformedConsent) Error ¶
func (e *ErrorMalformedConsent) Error() string
type FullEnforcement ¶
type FullEnforcement struct {
// contains filtered or unexported fields
}
FullEnforcement determines if legal basis is satisfied for a given purpose and bidde/analytics adapterr using the TCF2 full enforcement algorithm. The algorithm is a detailed confirmation that reads the GVL, interprets the consent string and performs legal basis analysis necessary to perform a privacy-protected activity. FullEnforcement implements the PurposeEnforcer interface
func (*FullEnforcement) LegalBasis ¶
func (fe *FullEnforcement) LegalBasis(vendorInfo VendorInfo, name string, consent tcf2.ConsentMetadata, overrides Overrides) bool
LegalBasis determines if legal basis is satisfied for a given purpose and bidder/analytics adapter based on the vendor claims in the GVL, publisher restrictions and user consent.
type LiveGVLVendorIDs ¶
type LiveGVLVendorIDs struct {
// contains filtered or unexported fields
}
LiveGVLVendorIDs provides thread-safe access to the set of vendor IDs present in the latest Global Vendor List. It uses atomic.Value so reads (on every request) are lock-free, while writes (periodic refresh) are safe without mutexes.
func NewLiveGVLVendorIDs ¶
func NewLiveGVLVendorIDs() *LiveGVLVendorIDs
NewLiveGVLVendorIDs creates a LiveGVLVendorIDs initialized with an empty set.
func (*LiveGVLVendorIDs) Contains ¶
func (l *LiveGVLVendorIDs) Contains(id uint16) bool
Contains returns true if the given vendor ID is in the current valid set. If the set is empty (e.g. the GVL fetch failed), all IDs are considered valid as a safe fallback.
func (*LiveGVLVendorIDs) Update ¶
func (l *LiveGVLVendorIDs) Update(newIDs map[uint16]struct{})
Update atomically replaces the valid vendor ID set. If newIDs is empty, the existing set is retained.
type Overrides ¶
type Overrides struct {
// contains filtered or unexported fields
}
Overrides specifies enforcement algorithm rule adjustments
type Permissions ¶
type Permissions interface {
// Determines whether or not the host company is allowed to read/write cookies.
//
// If the consent string was nonsensical, the returned error will be an ErrorMalformedConsent.
HostCookiesAllowed(ctx context.Context) (bool, error)
// Determines whether or not the given bidder is allowed to user personal info for ad targeting.
//
// If the consent string was nonsensical, the returned error will be an ErrorMalformedConsent.
BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.BidderName) (bool, error)
// Determines whether or not to send PI information to a bidder, or mask it out.
//
// If the consent string was nonsensical, the no permissions are granted.
AuctionActivitiesAllowed(ctx context.Context, bidderCoreName openrtb_ext.BidderName, bidder openrtb_ext.BidderName) AuctionPermissions
}
func NewPermissions ¶
func NewPermissions(cfg config.GDPR, tcf2Config TCF2ConfigReader, vendorIDs map[openrtb_ext.BidderName]uint16, validGVLVendorIDs *LiveGVLVendorIDs, fetcher VendorListFetcher, purposeEnforcerBuilder PurposeEnforcerBuilder, requestInfo RequestInfo, metricsEngine metrics.MetricsEngine) Permissions
NewPermissions gets a per-request Permissions object that can then be used to check GDPR permissions for a given bidder.
type PermissionsBuilder ¶
type PermissionsBuilder func(TCF2ConfigReader, RequestInfo) Permissions
func NewPermissionsBuilder ¶
func NewPermissionsBuilder(cfg config.GDPR, gvlVendorIDs map[openrtb_ext.BidderName]uint16, validGVLVendorIDs *LiveGVLVendorIDs, vendorListFetcher VendorListFetcher, me metrics.MetricsEngine) PermissionsBuilder
NewPermissionsBuilder takes host config data used to configure the builder function it returns
type PurposeEnforcer ¶
type PurposeEnforcer interface {
LegalBasis(vendorInfo VendorInfo, name string, consent tcf2.ConsentMetadata, overrides Overrides) bool
}
PurposeEnforcer represents the enforcement strategy for determining if legal basis is achieved for a purpose
type PurposeEnforcerBuilder ¶
type PurposeEnforcerBuilder func(p consentconstants.Purpose, name string) PurposeEnforcer
PurposeEnforcerBuilder generates an instance of PurposeEnforcer for a given purpose and bidder
func NewPurposeEnforcerBuilder ¶
func NewPurposeEnforcerBuilder(cfg TCF2ConfigReader) PurposeEnforcerBuilder
NewPurposeEnforcerBuilder creates a new instance of PurposeEnforcerBuilder. This function uses closures so that any enforcer generated by the returned builder may use the config and also be cached and reused within a request context
type PurposeEnforcers ¶
type PurposeEnforcers struct {
Full PurposeEnforcer
Basic PurposeEnforcer
}
PurposeEnforcers holds the full and basic enforcers for a purpose
type RequestInfo ¶
type Signal ¶
type Signal int
func GetGDPR ¶
func GetGDPR(req *openrtb_ext.RequestWrapper) (Signal, error)
GetGDPR will pull the gdpr flag from an openrtb request
func IntSignalParse ¶
IntSignalParse checks parameter i is not out of bounds and returns a GDPR signal error
func ParseGDPRDefaultValue ¶
func ParseGDPRDefaultValue(r *openrtb_ext.RequestWrapper, cfgDefault string, eeaCountries []string) Signal
ParseGDPRDefaultValue determines the default GDPR signal based on the request, configuration, and EEA countries.
func SignalNormalize ¶
SignalNormalize normalizes a GDPR signal to ensure it's always either SignalYes or SignalNo.
func StrSignalParse ¶
StrSignalParse returns a parsed GDPR signal or a parse error.
type TCF2ConfigBuilder ¶
type TCF2ConfigBuilder func(hostConfig config.TCF2, accountConfig config.AccountGDPR) TCF2ConfigReader
type TCF2ConfigReader ¶
type TCF2ConfigReader interface {
BasicEnforcementVendors() map[string]struct{}
FeatureOneEnforced() bool
FeatureOneVendorException(openrtb_ext.BidderName) bool
ChannelEnabled(config.ChannelType) bool
IsEnabled() bool
PurposeEnforced(consentconstants.Purpose) bool
PurposeEnforcementAlgo(consentconstants.Purpose) config.TCF2EnforcementAlgo
PurposeEnforcingVendors(consentconstants.Purpose) bool
PurposeVendorExceptions(consentconstants.Purpose) map[string]struct{}
PurposeOneTreatmentEnabled() bool
PurposeOneTreatmentAccessAllowed() bool
}
TCF2ConfigReader is an interface to access TCF2 configurations
func NewTCF2Config ¶
func NewTCF2Config(hostConfig config.TCF2, accountConfig config.AccountGDPR) TCF2ConfigReader
NewTCF2Config creates an instance of tcf2Config which implements the TCF2ConfigReader interface
type VendorInfo ¶
type VendorInfo struct {
// contains filtered or unexported fields
}
type VendorListFetcher ¶
type VendorListFetcher func(ctx context.Context, specVersion uint16, listVersion uint16, metricsEngine metrics.MetricsEngine) (vendorlist.VendorList, error)