Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BidstreamClient and SharingClient, deprecate UID2Client #63

Merged

Conversation

caroline-ttd
Copy link
Contributor

@caroline-ttd caroline-ttd commented Apr 3, 2024

Introduce two new clients BidStreamClient and SharingClient and deprecate the existing UID2Client.

@caroline-ttd caroline-ttd marked this pull request as ready for review April 5, 2024 05:40
src/main/java/com/uid2/client/BidstreamClient.java Outdated Show resolved Hide resolved
@@ -44,4 +44,8 @@ public enum DecryptionStatus {
* to decrypt a UID2 token. Ensure the factory class matches the token type you are decrypting.
*/
INVALID_IDENTITY_SCOPE,
/**
* INVALID_TOKEN_LIFETIME: If token generated timestamp is longer than allow_clock_skew_seconds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment is not correct, this error should occur when the token's lifetime is greater than is allowed

Copy link
Contributor

@jon8787 jon8787 Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not correct to say "longer than allow_clock_skew_seconds"; that doesn't cause this error.
We can write here: Token has invalid timestamps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, that makes sense.

src/main/java/com/uid2/client/BidstreamClient.java Outdated Show resolved Hide resolved
src/main/java/com/uid2/client/TokenHelper.java Outdated Show resolved Hide resolved
src/main/java/com/uid2/client/TokenHelper.java Outdated Show resolved Hide resolved
@@ -104,7 +92,12 @@ public void crossPlatformConsistencyCheck_Decrypt() throws Exception {
assertEquals(EXAMPLE_UID, res.getUid());
}

private static void validateAdvertisingToken(String advertisingTokenString, IdentityScope identityScope, IdentityType identityType) {
public static void validateAdvertisingToken(String advertisingTokenString, IdentityScope identityScope, IdentityType identityType, int tokenVersion) {
if (tokenVersion == 2) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use an enum for token versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a new class called TokenVersionForTesting for the token version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm ok why do we do it differently than C# ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel they are the same. in the C#, "TokenVersion" class is also only used for testing. here

Copy link
Contributor

@jon8787 jon8787 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a couple of minor comments

assertTrue(response.isSuccess());
assertEquals(EXAMPLE_UID, response.getUid());
assertEquals(tokenVersion.ordinal() + 2, response.getAdvertisingTokenVersion());
assertEquals(tokenVersion.ordinal() + 2, response.getAdvertisingTokenVersion());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate assertion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, will remove one.

@caroline-ttd caroline-ttd merged commit 670656b into main Apr 10, 2024
3 checks passed
@caroline-ttd caroline-ttd deleted the ccm-UID2-2878-dsp-refactor-and-check-token-lifetimes branch April 10, 2024 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants