Skip to content

Commit

Permalink
Removed Digitrust From Prebid Server (#1892)
Browse files Browse the repository at this point in the history
Co-authored-by: avolcy <alex.volcy@xandr.com>
  • Loading branch information
AlexBVolcy and avolcy authored Jul 1, 2021
1 parent 8335d83 commit b996cf9
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 266 deletions.
7 changes: 1 addition & 6 deletions adapters/adform/adformtest/supplemental/user-nil.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@
},
"user": {
"ext": {
"consent": "abc2",
"digitrust": {
"ID": "digitrustId",
"KeyV": 1,
"Pref": 0
}
"consent": "abc2"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion adapters/dmx/dmx.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (adapter *DmxAdapter) MakeRequests(request *openrtb2.BidRequest, req *adapt
}
if dmxReq.User.Ext != nil {
if err := json.Unmarshal(dmxReq.User.Ext, &userExt); err == nil {
if len(userExt.Eids) > 0 || (userExt.DigiTrust != nil && userExt.DigiTrust.ID != "") {
if len(userExt.Eids) > 0 {
anyHasId = true
}
}
Expand Down
77 changes: 18 additions & 59 deletions adapters/dmx/dmx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,50 +643,6 @@ func TestUserEidsOnly(t *testing.T) {
}
}

func TestUserDigitrustOnly(t *testing.T) {
var w, h int = 300, 250

var width, height int64 = int64(w), int64(h)

bidder, buildErr := Builder(openrtb_ext.BidderDmx, config.Adapter{
Endpoint: "https://dmx.districtm.io/b/v2"})

if buildErr != nil {
t.Fatalf("Builder returned unexpected error %v", buildErr)
}

imp1 := openrtb2.Imp{
ID: "imp1",
Ext: json.RawMessage("{\"bidder\":{\"dmxid\": \"1007\", \"memberid\": \"123456\", \"seller_id\":\"1008\"}}"),
Banner: &openrtb2.Banner{
W: &width,
H: &height,
Format: []openrtb2.Format{
{W: 300, H: 250},
},
}}

inputRequest := openrtb2.BidRequest{
Imp: []openrtb2.Imp{imp1, imp1, imp1},
Site: &openrtb2.Site{
Publisher: &openrtb2.Publisher{
ID: "10007",
},
},
User: &openrtb2.User{Ext: json.RawMessage(`{
"digitrust": {
"id": "11111111111",
"keyv": 4
}}`)},
ID: "1234",
}

actualAdapterRequests, _ := bidder.MakeRequests(&inputRequest, &adapters.ExtraRequestInfo{})
if len(actualAdapterRequests) != 1 {
t.Errorf("should have 1 request")
}
}

func TestUsersEids(t *testing.T) {
var w, h int = 300, 250

Expand Down Expand Up @@ -725,53 +681,56 @@ func TestUsersEids(t *testing.T) {
"rtiPartner": "TDID"
}
}]
},{
},
{
"source": "pubcid.org",
"uids": [{
"id":"11111111"
"id": "11111111"
}]
},
{
{
"source": "id5-sync.com",
"uids": [{
"id": "ID5-12345"
}]
},
{
},
{
"source": "parrable.com",
"uids": [{
"id": "01.1563917337.test-eid"
}]
},{
},
{
"source": "identityLink",
"uids": [{
"id": "11111111"
}]
},{
},
{
"source": "criteo",
"uids": [{
"id": "11111111"
}]
},{
},
{
"source": "britepool.com",
"uids": [{
"id": "11111111"
}]
},{
},
{
"source": "liveintent.com",
"uids": [{
"id": "11111111"
}]
},{
},
{
"source": "netid.de",
"uids": [{
"id": "11111111"
}]
}],
"digitrust": {
"id": "11111111111",
"keyv": 4
}}`)},
}]
}`)},
ID: "1234",
}

Expand Down
14 changes: 5 additions & 9 deletions adapters/rubicon/rubicon.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,11 @@ type rubiconUserDataExt struct {
}

type rubiconUserExt struct {
Consent string `json:"consent,omitempty"`
DigiTrust *openrtb_ext.ExtUserDigiTrust `json:"digitrust"`
Eids []openrtb_ext.ExtUserEid `json:"eids,omitempty"`
TpID []rubiconExtUserTpID `json:"tpid,omitempty"`
RP rubiconUserExtRP `json:"rp"`
LiverampIdl string `json:"liveramp_idl,omitempty"`
Consent string `json:"consent,omitempty"`
Eids []openrtb_ext.ExtUserEid `json:"eids,omitempty"`
TpID []rubiconExtUserTpID `json:"tpid,omitempty"`
RP rubiconUserExtRP `json:"rp"`
LiverampIdl string `json:"liveramp_idl,omitempty"`
}

type rubiconSiteExtRP struct {
Expand Down Expand Up @@ -772,9 +771,6 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *ada
continue
}
userExtRP.Consent = userExt.Consent
if userExt.DigiTrust != nil {
userExtRP.DigiTrust = userExt.DigiTrust
}
userExtRP.Eids = userExt.Eids

// set user.ext.tpid
Expand Down
10 changes: 1 addition & 9 deletions adapters/rubicon/rubicon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1039,11 +1039,7 @@ func TestOpenRTBRequest(t *testing.T) {
PxRatio: rubidata.devicePxRatio,
},
User: &openrtb2.User{
Ext: json.RawMessage(`{"digitrust": {
"id": "some-digitrust-id",
"keyv": 1,
"pref": 0
},
Ext: json.RawMessage(`{
"eids": [{
"source": "pubcid",
"id": "2402fc76-7b39-4f0e-bfc2-060ef7693648"
Expand Down Expand Up @@ -1117,10 +1113,6 @@ func TestOpenRTBRequest(t *testing.T) {
t.Fatal("Error unmarshalling request.user.ext object.")
}

assert.Equal(t, "some-digitrust-id", userExt.DigiTrust.ID, "DigiTrust ID id not as expected!")
assert.Equal(t, 1, userExt.DigiTrust.KeyV, "DigiTrust KeyV id not as expected!")
assert.Equal(t, 0, userExt.DigiTrust.Pref, "DigiTrust Pref id not as expected!")

assert.NotNil(t, userExt.Eids)
assert.Equal(t, 1, len(userExt.Eids), "Eids values are not as expected!")
assert.Contains(t, userExt.Eids, openrtb_ext.ExtUserEid{Source: "pubcid", ID: "2402fc76-7b39-4f0e-bfc2-060ef7693648"})
Expand Down
1 change: 0 additions & 1 deletion adapters/rubicon/rubicontest/exemplary/simple-video.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@
}
],
"ext": {
"digitrust": null,
"rp": {
"target": {
"iab": [
Expand Down
12 changes: 2 additions & 10 deletions endpoints/openrtb2/amp_auction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ func TestGoodAmpRequests(t *testing.T) {
goodRequests := map[string]json.RawMessage{
"1": json.RawMessage(validRequest(t, "aliased-buyeruids.json")),
"2": json.RawMessage(validRequest(t, "aliases.json")),
"4": json.RawMessage(validRequest(t, "digitrust.json")),
"5": json.RawMessage(validRequest(t, "gdpr-no-consentstring.json")),
"6": json.RawMessage(validRequest(t, "gdpr.json")),
"7": json.RawMessage(validRequest(t, "site.json")),
Expand Down Expand Up @@ -122,11 +121,6 @@ func TestAMPPageInfo(t *testing.T) {
func TestGDPRConsent(t *testing.T) {
consent := "BOu5On0Ou5On0ADACHENAO7pqzAAppY"
existingConsent := "BONV8oqONXwgmADACHENAO7pqzAAppY"
digitrust := &openrtb_ext.ExtUserDigiTrust{
ID: "anyDigitrustID",
KeyV: 1,
Pref: 0,
}

testCases := []struct {
description string
Expand Down Expand Up @@ -165,12 +159,10 @@ func TestGDPRConsent(t *testing.T) {
description: "Overrides Existing Consent - With Sibling Data",
consent: consent,
userExt: &openrtb_ext.ExtUser{
Consent: existingConsent,
DigiTrust: digitrust,
Consent: existingConsent,
},
expectedUserExt: openrtb_ext.ExtUser{
Consent: consent,
DigiTrust: digitrust,
Consent: consent,
},
},
{
Expand Down
6 changes: 1 addition & 5 deletions endpoints/openrtb2/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -1124,13 +1124,9 @@ func (deps *endpointDeps) validateUser(user *openrtb2.User, aliases map[string]s
}

if user.Ext != nil {
// Creating ExtUser object to check if DigiTrust is valid
// Creating ExtUser object
var userExt openrtb_ext.ExtUser
if err := json.Unmarshal(user.Ext, &userExt); err == nil {
if userExt.DigiTrust != nil && userExt.DigiTrust.Pref != 0 {
// DigiTrust is not valid. Return error.
return errors.New("request.user contains a digitrust object that is not valid.")
}
// Check if the buyeruids are valid
if userExt.Prebid != nil {
if len(userExt.Prebid.BuyerUIDs) < 1 {
Expand Down
46 changes: 0 additions & 46 deletions endpoints/openrtb2/sample-requests/invalid-whole/digitrust.json

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions exchange/exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,7 @@ func newRaceCheckingRequest(t *testing.T) *openrtb2.BidRequest {
User: &openrtb2.User{
ID: "our-id",
BuyerUID: "their-id",
Ext: json.RawMessage(`{"consent":"BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw","digitrust":{"id":"digi-id","keyv":1,"pref":1}}`),
Ext: json.RawMessage(`{"consent":"BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw"}`),
},
Regs: &openrtb2.Regs{
COPPA: 1,
Expand Down Expand Up @@ -1949,7 +1949,7 @@ func TestPanicRecoveryHighLevel(t *testing.T) {
User: &openrtb2.User{
ID: "our-id",
BuyerUID: "their-id",
Ext: json.RawMessage(`{"consent":"BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw","digitrust":{"id":"digi-id","keyv":1,"pref":1}}`),
Ext: json.RawMessage(`{"consent":"BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw"}`),
},
Imp: []openrtb2.Imp{{
ID: "some-imp-id",
Expand Down
14 changes: 1 addition & 13 deletions exchange/exchangetest/request-other-user-ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
"buyeruids": {
"appnexus": "explicit-appnexus"
}
},
"digitrust": {
"id": "digi-id",
"keyv": 1,
"pref": 2
}
}
},
Expand Down Expand Up @@ -48,14 +43,7 @@
},
"user": {
"id": "foo",
"buyeruid": "explicit-appnexus",
"ext": {
"digitrust": {
"id": "digi-id",
"keyv": 1,
"pref": 2
}
}
"buyeruid": "explicit-appnexus"
},
"imp": [
{
Expand Down
Loading

0 comments on commit b996cf9

Please sign in to comment.