gdpr

package
v0.275.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 20 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowAll = AuctionPermissions{
	AllowBidRequest: true,
	PassGeo:         true,
	PassID:          true,
}
View Source
var AllowBidRequestOnly = AuctionPermissions{
	AllowBidRequest: true,
	PassGeo:         false,
	PassID:          false,
}
View Source
var DenyAll = AuctionPermissions{
	AllowBidRequest: false,
	PassGeo:         false,
	PassID:          false,
}

Functions

func VendorListURLMaker added in v0.206.0

func VendorListURLMaker(specVersion, listVersion uint16) string

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) (permissions AuctionPermissions, err error)

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) (permissions AuctionPermissions, err error)

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 added in v0.211.0

type AuctionPermissions struct {
	AllowBidRequest bool
	PassGeo         bool
	PassID          bool
}

type BasicEnforcement added in v0.233.0

type BasicEnforcement struct {
	// contains filtered or unexported fields
}

BasicEnforcement determines if legal basis is satisfied for a given purpose and bidder 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 added in v0.233.0

func (be *BasicEnforcement) LegalBasis(vendorInfo VendorInfo, bidder openrtb_ext.BidderName, consent tcf2.ConsentMetadata, overrides Overrides) bool

LegalBasis determines if legal basis is satisfied for a given purpose and bidder based on user consent and legal basis signals.

type BidderInfo added in v0.233.0

type BidderInfo struct {
	// contains filtered or unexported fields
}

type ErrorMalformedConsent

type ErrorMalformedConsent struct {
	Consent string
	Cause   error
}

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 added in v0.233.0

type FullEnforcement struct {
	// contains filtered or unexported fields
}

FullEnforcement determines if legal basis is satisfied for a given purpose and bidder 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 added in v0.233.0

func (fe *FullEnforcement) LegalBasis(vendorInfo VendorInfo, bidder openrtb_ext.BidderName, consent tcf2.ConsentMetadata, overrides Overrides) bool

LegalBasis determines if legal basis is satisfied for a given purpose and bidder based on the vendor claims in the GVL, publisher restrictions and user consent.

type Overrides added in v0.233.0

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 returned error will be an ErrorMalformedConsent.
	AuctionActivitiesAllowed(ctx context.Context, bidderCoreName openrtb_ext.BidderName, bidder openrtb_ext.BidderName) (permissions AuctionPermissions, err error)
}

func NewPermissions

func NewPermissions(cfg config.GDPR, tcf2Config TCF2ConfigReader, vendorIDs map[openrtb_ext.BidderName]uint16, fetcher VendorListFetcher, purposeEnforcerBuilder PurposeEnforcerBuilder, requestInfo RequestInfo) Permissions

NewPermissions gets a per-request Permissions object that can then be used to check GDPR permissions for a given bidder.

type PermissionsBuilder added in v0.206.0

type PermissionsBuilder func(TCF2ConfigReader, RequestInfo) Permissions

func NewPermissionsBuilder added in v0.213.0

func NewPermissionsBuilder(cfg config.GDPR, gvlVendorIDs map[openrtb_ext.BidderName]uint16, vendorListFetcher VendorListFetcher) PermissionsBuilder

NewPermissionsBuilder takes host config data used to configure the builder function it returns

type PurposeEnforcer added in v0.233.0

type PurposeEnforcer interface {
	LegalBasis(vendorInfo VendorInfo, bidder openrtb_ext.BidderName, consent tcf2.ConsentMetadata, overrides Overrides) bool
}

PurposeEnforcer represents the enforcement strategy for determining if legal basis is achieved for a purpose

type PurposeEnforcerBuilder added in v0.233.0

type PurposeEnforcerBuilder func(p consentconstants.Purpose, bidder openrtb_ext.BidderName) PurposeEnforcer

PurposeEnforcerBuilder generates an instance of PurposeEnforcer for a given purpose and bidder

func NewPurposeEnforcerBuilder added in v0.233.0

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 added in v0.233.0

type PurposeEnforcers struct {
	Full  PurposeEnforcer
	Basic PurposeEnforcer
}

PurposeEnforcers holds the full and basic enforcers for a purpose

type RequestInfo added in v0.215.0

type RequestInfo struct {
	AliasGVLIDs map[string]uint16
	Consent     string
	GDPRSignal  Signal
	PublisherID string
}

type Signal

type Signal int
const (
	SignalAmbiguous Signal = -1
	SignalNo        Signal = 0
	SignalYes       Signal = 1
)

func IntSignalParse added in v0.256.0

func IntSignalParse(i int) (Signal, error)

IntSignalParse checks parameter i is not out of bounds and returns a GDPR signal error

func SignalNormalize added in v0.173.0

func SignalNormalize(signal Signal, gdprDefaultValue string) Signal

SignalNormalize normalizes a GDPR signal to ensure it's always either SignalYes or SignalNo.

func StrSignalParse added in v0.256.0

func StrSignalParse(signal string) (Signal, error)

StrSignalParse returns a parsed GDPR signal or a parse error.

type TCF2ConfigBuilder added in v0.206.0

type TCF2ConfigBuilder func(hostConfig config.TCF2, accountConfig config.AccountGDPR) TCF2ConfigReader

type TCF2ConfigReader added in v0.206.0

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[openrtb_ext.BidderName]struct{}
	PurposeOneTreatmentEnabled() bool
	PurposeOneTreatmentAccessAllowed() bool
}

TCF2ConfigReader is an interface to access TCF2 configurations

func NewTCF2Config added in v0.206.0

func NewTCF2Config(hostConfig config.TCF2, accountConfig config.AccountGDPR) TCF2ConfigReader

NewTCF2Config creates an instance of tcf2Config which implements the TCF2ConfigReader interface

type VendorInfo added in v0.233.0

type VendorInfo struct {
	// contains filtered or unexported fields
}

type VendorListFetcher added in v0.206.0

type VendorListFetcher func(ctx context.Context, specVersion uint16, listVersion uint16) (vendorlist.VendorList, error)

func NewVendorListFetcher added in v0.206.0

func NewVendorListFetcher(initCtx context.Context, cfg config.GDPR, client *http.Client, urlMaker func(uint16, uint16) string) VendorListFetcher

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL