Skip to content

Commit

Permalink
Add missing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
asloobq committed Oct 8, 2024
1 parent 7c0c971 commit b850865
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/uid2/client/BidstreamClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public DecryptionResponse decryptTokenIntoRawUid(String token, String domainOrAp
return tokenHelper.decrypt(token, Instant.now(), domainOrAppNameFromBidRequest, ClientType.BIDSTREAM);
}

DecryptionResponse decryptTokenIntoRawUid(String token, String domainOrAppNameFromBidRequest, Instant now) {
public DecryptionResponse decryptTokenIntoRawUid(String token, String domainOrAppNameFromBidRequest, Instant now) {
return tokenHelper.decrypt(token, now, domainOrAppNameFromBidRequest, ClientType.BIDSTREAM);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/uid2/client/DecryptionStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public enum DecryptionStatus {
*/
INVALID_TOKEN_LIFETIME,
/**
* 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
* 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
*/
DOMAIN_OR_APP_NAME_CHECK_FAILED
}
7 changes: 7 additions & 0 deletions src/test/java/com/uid2/client/BidstreamClientTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,13 @@ public void tokenExpiryAndCustomNow() throws Exception {

res = bidstreamClient.decryptTokenIntoRawUid(advertisingToken, null, expiry.minus(1, ChronoUnit.SECONDS));
assertEquals(EXAMPLE_UID, res.getUid());

// case when domain / app name is present
int privacyBits = PrivacyBitsBuilder.Builder().WithClientSideGenerated(true).Build();
String cstgAdvertisingToken = AdvertisingTokenBuilder.builder().withExpiry(expiry).withGenerated(generated)
.withPrivacyBits(privacyBits).build();
res = bidstreamClient.decryptTokenIntoRawUid(cstgAdvertisingToken, "example.com", expiry.minus(1, ChronoUnit.SECONDS));
assertTrue(res.isSuccess());
}

@ParameterizedTest
Expand Down

0 comments on commit b850865

Please sign in to comment.