Skip to content

Commit b850865

Browse files
committed
Add missing test case
1 parent 7c0c971 commit b850865

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/main/java/com/uid2/client/BidstreamClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public DecryptionResponse decryptTokenIntoRawUid(String token, String domainOrAp
1313
return tokenHelper.decrypt(token, Instant.now(), domainOrAppNameFromBidRequest, ClientType.BIDSTREAM);
1414
}
1515

16-
DecryptionResponse decryptTokenIntoRawUid(String token, String domainOrAppNameFromBidRequest, Instant now) {
16+
public DecryptionResponse decryptTokenIntoRawUid(String token, String domainOrAppNameFromBidRequest, Instant now) {
1717
return tokenHelper.decrypt(token, now, domainOrAppNameFromBidRequest, ClientType.BIDSTREAM);
1818
}
1919

src/main/java/com/uid2/client/DecryptionStatus.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public enum DecryptionStatus {
4949
*/
5050
INVALID_TOKEN_LIFETIME,
5151
/**
52-
* DOMAIN_OR_APP_NAME_CHECK_FAILED: The supplied domain name or app name doesn't match with the allowed names of the participant who generated this token
52+
* DOMAIN_OR_APP_NAME_CHECK_FAILED: The supplied domain name or app name doesn't match with the allowed names of the site/app where this token was generated
5353
*/
5454
DOMAIN_OR_APP_NAME_CHECK_FAILED
5555
}

src/test/java/com/uid2/client/BidstreamClientTests.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,13 @@ public void tokenExpiryAndCustomNow() throws Exception {
389389

390390
res = bidstreamClient.decryptTokenIntoRawUid(advertisingToken, null, expiry.minus(1, ChronoUnit.SECONDS));
391391
assertEquals(EXAMPLE_UID, res.getUid());
392+
393+
// case when domain / app name is present
394+
int privacyBits = PrivacyBitsBuilder.Builder().WithClientSideGenerated(true).Build();
395+
String cstgAdvertisingToken = AdvertisingTokenBuilder.builder().withExpiry(expiry).withGenerated(generated)
396+
.withPrivacyBits(privacyBits).build();
397+
res = bidstreamClient.decryptTokenIntoRawUid(cstgAdvertisingToken, "example.com", expiry.minus(1, ChronoUnit.SECONDS));
398+
assertTrue(res.isSuccess());
392399
}
393400

394401
@ParameterizedTest

0 commit comments

Comments
 (0)