Skip to content

Commit

Permalink
Merge branch 'master' into update/bump-depens
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Zhevedenko committed Dec 3, 2021
2 parents 686d36a + 7f27cf3 commit a45a780
Show file tree
Hide file tree
Showing 185 changed files with 4,817 additions and 2,970 deletions.
14 changes: 10 additions & 4 deletions extra/bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.prebid</groupId>
<parent>
<groupId>org.prebid</groupId>
<artifactId>prebid-server-aggregator</artifactId>
<version>1.80.0-SNAPSHOT</version>
<relativePath>../../extra/pom.xml</relativePath>
</parent>

<artifactId>prebid-server-bundle</artifactId>
<version>1.79.0-SNAPSHOT</version>

<name>prebid-server-bundle</name>
<description>Creates bundle (fat jar) with PBS-Core and other submodules listed as dependency</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -69,12 +75,12 @@
<dependency>
<groupId>org.prebid</groupId>
<artifactId>prebid-server</artifactId>
<version>1.79.0-SNAPSHOT</version>
<version>1.80.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>ortb2-blocking</artifactId>
<version>1.79.0-SNAPSHOT</version>
<version>1.80.0-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion extra/modules/ortb2-blocking/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>1.79.0-SNAPSHOT</version>
<version>1.80.0-SNAPSHOT</version>
</parent>

<artifactId>ortb2-blocking</artifactId>
Expand Down
13 changes: 11 additions & 2 deletions extra/modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.prebid</groupId>
<artifactId>prebid-server-aggregator</artifactId>
<version>1.80.0-SNAPSHOT</version>
<relativePath>../../extra/pom.xml</relativePath>
</parent>

<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>1.79.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>all-modules</name>
<description>Umbrellas all PBS modules</description>

<modules>
<module>ortb2-blocking</module>
</modules>
Expand All @@ -17,7 +26,7 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>

<prebid-server.version>1.79.0-SNAPSHOT</prebid-server.version>
<prebid-server.version>1.80.0-SNAPSHOT</prebid-server.version>

<lombok.version>1.18.22</lombok.version>

Expand Down
2 changes: 1 addition & 1 deletion extra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.prebid</groupId>
<artifactId>prebid-server-aggregator</artifactId>
<version>1.79.0-SNAPSHOT</version>
<version>1.80.0-SNAPSHOT</version>
<packaging>pom</packaging>

<scm>
Expand Down
11 changes: 8 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.prebid</groupId>
<parent>
<groupId>org.prebid</groupId>
<artifactId>prebid-server-aggregator</artifactId>
<version>1.80.0-SNAPSHOT</version>
<relativePath>extra/pom.xml</relativePath>
</parent>

<artifactId>prebid-server</artifactId>
<version>1.79.0-SNAPSHOT</version>

<name>prebid-server</name>
<description>Prebid Server (Server-side Header Bidding)</description>
<organization>
<name>Prebid.org</name>
<url>http://prebid.org/</url>
<url>https://prebid.org/</url>
</organization>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.prebid.server.auction.model.IpAddress;
import org.prebid.server.bidder.BidderCatalog;
import org.prebid.server.execution.Timeout;
import org.prebid.server.geolocation.CountryCodeMapper;
import org.prebid.server.metric.MetricName;
import org.prebid.server.metric.Metrics;
import org.prebid.server.privacy.PrivacyExtractor;
Expand Down Expand Up @@ -70,6 +71,7 @@ public class PrivacyEnforcementService {
private final ImplicitParametersExtractor implicitParametersExtractor;
private final IpAddressHelper ipAddressHelper;
private final Metrics metrics;
private final CountryCodeMapper countryCodeMapper;
private final boolean ccpaEnforce;
private final boolean lmtEnforce;

Expand All @@ -79,6 +81,7 @@ public PrivacyEnforcementService(BidderCatalog bidderCatalog,
ImplicitParametersExtractor implicitParametersExtractor,
IpAddressHelper ipAddressHelper,
Metrics metrics,
CountryCodeMapper countryCodeMapper,
boolean ccpaEnforce,
boolean lmtEnforce) {

Expand All @@ -88,6 +91,7 @@ public PrivacyEnforcementService(BidderCatalog bidderCatalog,
this.implicitParametersExtractor = Objects.requireNonNull(implicitParametersExtractor);
this.ipAddressHelper = Objects.requireNonNull(ipAddressHelper);
this.metrics = Objects.requireNonNull(metrics);
this.countryCodeMapper = Objects.requireNonNull(countryCodeMapper);
this.ccpaEnforce = ccpaEnforce;
this.lmtEnforce = lmtEnforce;
}
Expand All @@ -103,22 +107,32 @@ public Future<PrivacyContext> contextFromBidRequest(AuctionContext auctionContex
final Privacy privacy = privacyExtractor.validPrivacyFrom(bidRequest, errors);

final Device device = bidRequest.getDevice();

final Geo geo = device != null ? device.getGeo() : null;
final String country = geo != null ? geo.getCountry() : null;

final String alpha2CountryCode = resolveAlpha2CountryCode(device);
final String effectiveIpAddress = resolveIpAddress(device, privacy);

final AccountGdprConfig accountGdpr = accountGdprConfig(account);
final String accountId = account.getId();
final RequestLogInfo requestLogInfo = requestLogInfo(requestType, bidRequest, accountId);

return tcfDefinerService.resolveTcfContext(
privacy, country, effectiveIpAddress, accountGdpr, requestType, requestLogInfo, timeout,
privacy,
alpha2CountryCode,
effectiveIpAddress,
accountGdpr,
requestType,
requestLogInfo,
timeout,
debugWarnings)
.map(tcfContext -> PrivacyContext.of(privacy, tcfContext, tcfContext.getIpAddress()));
}

private String resolveAlpha2CountryCode(Device device) {
final Geo geo = device != null ? device.getGeo() : null;
final String alpha3CountryCode = geo != null ? geo.getCountry() : null;

return countryCodeMapper.mapToAlpha2(alpha3CountryCode);
}

private String resolveIpAddress(Device device, Privacy privacy) {
final boolean shouldBeMasked = isCoppaMaskingRequired(privacy) || isLmtEnabled(device);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,22 +316,14 @@ private BidRequest mergeWithDefaultBidRequest(BidRequestVideo videoRequest, List

final Site site = videoRequest.getSite();
if (site != null) {
final Content content = videoRequest.getContent();
if (content != null) {
bidRequestBuilder.site(site.toBuilder()
.content(content)
.build());
}
final Site updatedSite = updateSite(site, videoRequest);
bidRequestBuilder.site(updatedSite);
}

final App app = videoRequest.getApp();
if (app != null) {
final Content content = videoRequest.getContent();
if (content != null) {
bidRequestBuilder.app(app.toBuilder()
.content(content)
.build());
}
final App updatedApp = updateApp(app, videoRequest);
bidRequestBuilder.app(updatedApp);
}

final Device device = videoRequest.getDevice();
Expand Down Expand Up @@ -372,6 +364,28 @@ private BidRequest mergeWithDefaultBidRequest(BidRequestVideo videoRequest, List
.build();
}

private static Site updateSite(Site site, BidRequestVideo videoRequest) {
final Content content = videoRequest.getContent();
if (content != null) {
return site.toBuilder()
.content(content)
.build();
}

return site;
}

private static App updateApp(App app, BidRequestVideo videoRequest) {
final Content content = videoRequest.getContent();
if (content != null) {
return app.toBuilder()
.content(content)
.build();
}

return app;
}

private void addRequiredOpenRtbFields(BidRequest.BidRequestBuilder bidRequestBuilder) {
bidRequestBuilder.cur(Collections.singletonList(currency));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import org.prebid.server.util.ObjectUtil;
import org.prebid.server.util.StreamUtil;

import java.util.Arrays;
import java.util.Collections;
import java.util.Currency;
import java.util.HashSet;
Expand All @@ -62,8 +61,8 @@ public class Ortb2ImplicitParametersResolver {
private static final String PREBID_EXT = "prebid";
private static final String BIDDER_EXT = "bidder";

private static final Set<String> IMP_EXT_NON_BIDDER_FIELDS = Collections.unmodifiableSet(new HashSet<>(
Arrays.asList(PREBID_EXT, "context", "all", "general", "skadn", "data")));
private static final Set<String> IMP_EXT_NON_BIDDER_FIELDS =
Set.of(PREBID_EXT, "context", "all", "general", "skadn", "data", "gpid");

private final boolean shouldCacheOnlyWinningBids;
private final String adServerCurrency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.prebid.server.exception.UnauthorizedAccountException;
import org.prebid.server.execution.Timeout;
import org.prebid.server.execution.TimeoutFactory;
import org.prebid.server.geolocation.CountryCodeMapper;
import org.prebid.server.geolocation.model.GeoInfo;
import org.prebid.server.hooks.execution.HookStageExecutor;
import org.prebid.server.hooks.execution.model.HookExecutionContext;
Expand Down Expand Up @@ -80,6 +81,7 @@ public class Ortb2RequestFactory {
private final DealsProcessor dealsProcessor;
private final IpAddressHelper ipAddressHelper;
private final HookStageExecutor hookStageExecutor;
private final CountryCodeMapper countryCodeMapper;
private final Clock clock;

public Ortb2RequestFactory(boolean enforceValidAccount,
Expand All @@ -93,6 +95,7 @@ public Ortb2RequestFactory(boolean enforceValidAccount,
IpAddressHelper ipAddressHelper,
HookStageExecutor hookStageExecutor,
DealsProcessor dealsProcessor,
CountryCodeMapper countryCodeMapper,
Clock clock) {

this.enforceValidAccount = enforceValidAccount;
Expand All @@ -106,6 +109,7 @@ public Ortb2RequestFactory(boolean enforceValidAccount,
this.ipAddressHelper = Objects.requireNonNull(ipAddressHelper);
this.hookStageExecutor = Objects.requireNonNull(hookStageExecutor);
this.dealsProcessor = dealsProcessor;
this.countryCodeMapper = Objects.requireNonNull(countryCodeMapper);
this.clock = Objects.requireNonNull(clock);
}

Expand Down Expand Up @@ -403,9 +407,8 @@ private Device enrichDevice(Device device, PrivacyContext privacyContext) {

final Geo geo = ObjectUtil.getIfNotNull(device, Device::getGeo);
final String countryInRequest = ObjectUtil.getIfNotNull(geo, Geo::getCountry);
final String country = ObjectUtil.getIfNotNull(privacyContext.getTcfContext().getGeoInfo(),
GeoInfo::getCountry);
final boolean shouldUpdateCountry = country != null && !Objects.equals(countryInRequest, country);
final String alpha3CountryCode = resolveAlpha3CountryCode(privacyContext);
final boolean shouldUpdateCountry = alpha3CountryCode != null && !alpha3CountryCode.equals(countryInRequest);

if (shouldUpdateIpV4 || shouldUpdateIpV6 || shouldUpdateCountry) {
final Device.DeviceBuilder deviceBuilder = device != null ? device.toBuilder() : Device.builder();
Expand All @@ -420,7 +423,7 @@ private Device enrichDevice(Device device, PrivacyContext privacyContext) {

if (shouldUpdateCountry) {
final Geo.GeoBuilder geoBuilder = geo != null ? geo.toBuilder() : Geo.builder();
geoBuilder.country(country);
geoBuilder.country(alpha3CountryCode);
deviceBuilder.geo(geoBuilder.build());
}

Expand All @@ -430,6 +433,13 @@ private Device enrichDevice(Device device, PrivacyContext privacyContext) {
return null;
}

private String resolveAlpha3CountryCode(PrivacyContext privacyContext) {
final String alpha2CountryCode = ObjectUtil.getIfNotNull(
privacyContext.getTcfContext().getGeoInfo(), GeoInfo::getCountry);

return countryCodeMapper.mapToAlpha3(alpha2CountryCode);
}

private static String accountDefaultIntegration(Account account) {
final AccountAuctionConfig accountAuctionConfig = account.getAuction();

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/prebid/server/bidder/OpenrtbBidder.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public final Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest b
try {
final T impExt = parseImpExt(imp);
final Imp modifiedImp = modifyImp(imp, impExt);
modifiedImpsWithExts.add(new ImpWithExt<>(modifiedImp, impExt));
modifiedImpsWithExts.add(ImpWithExt.of(modifiedImp, impExt));
} catch (PreBidException e) {
errors.add(BidderError.badInput(e.getMessage()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
public enum ViewabilityVendors {

activeview("doubleclickbygoogle.com"),
adform("adform.com"),
comscore("comscore.com"),
doubleverify("doubleverify.com"),
integralads("integralads.com"),
Expand Down
Loading

0 comments on commit a45a780

Please sign in to comment.