diff --git a/conf/docker-config.json b/conf/docker-config.json index 648b922a8..25f38e6ae 100644 --- a/conf/docker-config.json +++ b/conf/docker-config.json @@ -4,7 +4,6 @@ "storage_mock": true, "refresh_token_expires_after_seconds": 86400, "refresh_identity_token_after_seconds": 900, - "advertising_token_v3": false, "refresh_token_v3": false, "identity_v3": false, "identity_scope": "uid2", diff --git a/conf/local-config.json b/conf/local-config.json index 7a3200f12..6a357dba1 100644 --- a/conf/local-config.json +++ b/conf/local-config.json @@ -12,8 +12,6 @@ "identity_token_expires_after_seconds": 3600, "refresh_token_expires_after_seconds": 86400, "refresh_identity_token_after_seconds": 900, - "advertising_token_v3": false, - "advertising_token_v4_percentage": 0, "refresh_token_v3": false, "identity_v3": false, "identity_scope": "uid2", diff --git a/conf/local-e2e-docker-private-config.json b/conf/local-e2e-docker-private-config.json index ef05b8772..8637e6da3 100644 --- a/conf/local-e2e-docker-private-config.json +++ b/conf/local-e2e-docker-private-config.json @@ -14,7 +14,6 @@ "identity_token_expires_after_seconds": 3600, "refresh_token_expires_after_seconds": 86400, "refresh_identity_token_after_seconds": 900, - "advertising_token_v3": false, "refresh_token_v3": true, "identity_v3": false, "identity_scope": "uid2", diff --git a/conf/local-e2e-docker-public-config.json b/conf/local-e2e-docker-public-config.json index 60f0abd92..a145c4d17 100644 --- a/conf/local-e2e-docker-public-config.json +++ b/conf/local-e2e-docker-public-config.json @@ -16,7 +16,6 @@ "identity_token_expires_after_seconds": 3600, "refresh_token_expires_after_seconds": 86400, "refresh_identity_token_after_seconds": 900, - "advertising_token_v3": false, "refresh_token_v3": true, "identity_v3": false, "identity_scope": "uid2", diff --git a/conf/local-e2e-private-config.json b/conf/local-e2e-private-config.json index e9d3f8b53..4ab52330f 100644 --- a/conf/local-e2e-private-config.json +++ b/conf/local-e2e-private-config.json @@ -16,7 +16,6 @@ "identity_token_expires_after_seconds": 3600, "refresh_token_expires_after_seconds": 86400, "refresh_identity_token_after_seconds": 900, - "advertising_token_v3": false, "refresh_token_v3": true, "identity_v3": false, "identity_scope": "uid2", diff --git a/conf/local-e2e-public-config.json b/conf/local-e2e-public-config.json index cb635b103..bfdc8e394 100644 --- a/conf/local-e2e-public-config.json +++ b/conf/local-e2e-public-config.json @@ -16,7 +16,6 @@ "identity_token_expires_after_seconds": 3600, "refresh_token_expires_after_seconds": 86400, "refresh_identity_token_after_seconds": 900, - "advertising_token_v3": false, "refresh_token_v3": true, "identity_v3": false, "identity_scope": "uid2", diff --git a/conf/validator-latest-e2e-docker-public-config.json b/conf/validator-latest-e2e-docker-public-config.json index cabf23380..8f82b01a4 100644 --- a/conf/validator-latest-e2e-docker-public-config.json +++ b/conf/validator-latest-e2e-docker-public-config.json @@ -17,7 +17,6 @@ "identity_token_expires_after_seconds": 3600, "refresh_token_expires_after_seconds": 86400, "refresh_identity_token_after_seconds": 900, - "advertising_token_v3": false, "refresh_token_v3": true, "identity_v3": false, "identity_scope": "uid2", diff --git a/scripts/aws/conf/default-config.json b/scripts/aws/conf/default-config.json index 1836f1aa7..35c3be58c 100644 --- a/scripts/aws/conf/default-config.json +++ b/scripts/aws/conf/default-config.json @@ -34,6 +34,5 @@ "failure_shutdown_wait_hours": 120, "sharing_token_expiry_seconds": 2592000, "validate_service_links": false, - "advertising_token_v4_percentage": 100, "operator_type": "private" } diff --git a/scripts/aws/conf/prod-euid-config.json b/scripts/aws/conf/prod-euid-config.json index 581ad0ae9..0fbf5d69c 100644 --- a/scripts/aws/conf/prod-euid-config.json +++ b/scripts/aws/conf/prod-euid-config.json @@ -24,7 +24,6 @@ "refresh_identity_token_after_seconds": 3600, "allow_legacy_api": false, "identity_scope": "euid", - "advertising_token_v3": true, "refresh_token_v3": true, "enable_phone_support": true, "enable_v1_phone_support": false, diff --git a/scripts/azure-cc/conf/default-config.json b/scripts/azure-cc/conf/default-config.json index c47eef8f6..4870b2fda 100644 --- a/scripts/azure-cc/conf/default-config.json +++ b/scripts/azure-cc/conf/default-config.json @@ -38,6 +38,5 @@ "failure_shutdown_wait_hours": 120, "sharing_token_expiry_seconds": 2592000, "validate_service_links": false, - "advertising_token_v4_percentage": 100, "operator_type": "private" } diff --git a/scripts/gcp-oidc/conf/default-config.json b/scripts/gcp-oidc/conf/default-config.json index aaea43364..6a65ee2d0 100644 --- a/scripts/gcp-oidc/conf/default-config.json +++ b/scripts/gcp-oidc/conf/default-config.json @@ -38,6 +38,5 @@ "failure_shutdown_wait_hours": 120, "sharing_token_expiry_seconds": 2592000, "validate_service_links": false, - "advertising_token_v4_percentage": 100, "operator_type": "private" } diff --git a/src/main/java/com/uid2/operator/service/UIDOperatorService.java b/src/main/java/com/uid2/operator/service/UIDOperatorService.java index 7e6450829..6d4ff86d0 100644 --- a/src/main/java/com/uid2/operator/service/UIDOperatorService.java +++ b/src/main/java/com/uid2/operator/service/UIDOperatorService.java @@ -46,8 +46,6 @@ public class UIDOperatorService implements IUIDOperatorService { private final Duration refreshIdentityAfter; private final OperatorIdentity operatorIdentity; - protected final TokenVersion tokenVersionToUseIfNotV4; - protected final int advertisingTokenV4Percentage; private final TokenVersion refreshTokenVersion; private final boolean identityV3Enabled; @@ -91,9 +89,6 @@ public UIDOperatorService(JsonObject config, IOptOutStore optOutStore, ISaltProv throw new IllegalStateException(REFRESH_TOKEN_EXPIRES_AFTER_SECONDS + " must be >= " + REFRESH_IDENTITY_TOKEN_AFTER_SECONDS); } - this.advertisingTokenV4Percentage = config.getInteger("advertising_token_v4_percentage", 0); //0 indicates token v4 will not be used - this.tokenVersionToUseIfNotV4 = config.getBoolean("advertising_token_v3", false) ? TokenVersion.V3 : TokenVersion.V2; - this.refreshTokenVersion = TokenVersion.V3; this.identityV3Enabled = config.getBoolean("identity_v3", false); } @@ -267,16 +262,7 @@ private RefreshToken createRefreshToken(PublisherIdentity publisherIdentity, Use } private AdvertisingToken createAdvertisingToken(PublisherIdentity publisherIdentity, UserIdentity userIdentity, Instant now) { - TokenVersion tokenVersion; - int pseudoRandomNumber = 1; - final var rawUid = userIdentity.id; - if (rawUid.length > 2) - { - int hash = ((rawUid[0] & 0xFF) << 12) | ((rawUid[1] & 0xFF) << 4) | ((rawUid[2] & 0xFF) & 0xF); //using same logic as ModBasedSaltEntryIndexer.getIndex() in uid2-shared - pseudoRandomNumber = (hash % 100) + 1; //1 to 100 - } - tokenVersion = (pseudoRandomNumber <= this.advertisingTokenV4Percentage) ? TokenVersion.V4 : this.tokenVersionToUseIfNotV4; - return new AdvertisingToken(tokenVersion, now, now.plusMillis(identityExpiresAfter.toMillis()), this.operatorIdentity, publisherIdentity, userIdentity); + return new AdvertisingToken(TokenVersion.V4, now, now.plusMillis(identityExpiresAfter.toMillis()), this.operatorIdentity, publisherIdentity, userIdentity); } static protected class GlobalOptoutResult { diff --git a/src/test/java/com/uid2/operator/EUIDOperatorVerticleTest.java b/src/test/java/com/uid2/operator/EUIDOperatorVerticleTest.java index 8d168d42e..138e17777 100644 --- a/src/test/java/com/uid2/operator/EUIDOperatorVerticleTest.java +++ b/src/test/java/com/uid2/operator/EUIDOperatorVerticleTest.java @@ -18,9 +18,6 @@ public class EUIDOperatorVerticleTest extends UIDOperatorVerticleTest { public EUIDOperatorVerticleTest() throws IOException { } - @Override - protected TokenVersion getTokenVersion() {return TokenVersion.V3;} - @Override protected IdentityScope getIdentityScope() { return IdentityScope.EUID; } @Override diff --git a/src/test/java/com/uid2/operator/EUIDOperatorVerticleV4Test.java b/src/test/java/com/uid2/operator/EUIDOperatorVerticleV4Test.java deleted file mode 100644 index fb5ff985b..000000000 --- a/src/test/java/com/uid2/operator/EUIDOperatorVerticleV4Test.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.uid2.operator; - -import com.uid2.shared.model.TokenVersion; - -import java.io.IOException; - -public class EUIDOperatorVerticleV4Test extends EUIDOperatorVerticleTest { - public EUIDOperatorVerticleV4Test() throws IOException { - } - - @Override - protected TokenVersion getTokenVersion() { - return TokenVersion.V4; - } -} diff --git a/src/test/java/com/uid2/operator/UIDOperatorServiceTest.java b/src/test/java/com/uid2/operator/UIDOperatorServiceTest.java index 4a8aef9d1..37eeef36f 100644 --- a/src/test/java/com/uid2/operator/UIDOperatorServiceTest.java +++ b/src/test/java/com/uid2/operator/UIDOperatorServiceTest.java @@ -57,11 +57,6 @@ class ExtendedUIDOperatorService extends UIDOperatorService { public ExtendedUIDOperatorService(JsonObject config, IOptOutStore optOutStore, ISaltProvider saltProvider, ITokenEncoder encoder, Clock clock, IdentityScope identityScope, Handler saltRetrievalResponseHandler) { super(config, optOutStore, saltProvider, encoder, clock, identityScope, saltRetrievalResponseHandler); } - - public TokenVersion getAdvertisingTokenVersionForTests() { - assert this.advertisingTokenV4Percentage == 0 || this.advertisingTokenV4Percentage == 100; //we want tests to be deterministic - return this.advertisingTokenV4Percentage == 100 ? TokenVersion.V4 : this.tokenVersionToUseIfNotV4; - } } @BeforeEach @@ -93,8 +88,6 @@ void setup() throws Exception { uid2Config.put(UIDOperatorService.IDENTITY_TOKEN_EXPIRES_AFTER_SECONDS, IDENTITY_TOKEN_EXPIRES_AFTER_SECONDS); uid2Config.put(UIDOperatorService.REFRESH_TOKEN_EXPIRES_AFTER_SECONDS, REFRESH_TOKEN_EXPIRES_AFTER_SECONDS); uid2Config.put(UIDOperatorService.REFRESH_IDENTITY_TOKEN_AFTER_SECONDS, REFRESH_IDENTITY_TOKEN_AFTER_SECONDS); - uid2Config.put("advertising_token_v4_percentage", 100); - uid2Config.put("advertising_token_v3", false); // prod is using v2 token version for now uid2Config.put("identity_v3", false); uid2Service = new ExtendedUIDOperatorService( @@ -111,8 +104,6 @@ void setup() throws Exception { euidConfig.put(UIDOperatorService.IDENTITY_TOKEN_EXPIRES_AFTER_SECONDS, IDENTITY_TOKEN_EXPIRES_AFTER_SECONDS); euidConfig.put(UIDOperatorService.REFRESH_TOKEN_EXPIRES_AFTER_SECONDS, REFRESH_TOKEN_EXPIRES_AFTER_SECONDS); euidConfig.put(UIDOperatorService.REFRESH_IDENTITY_TOKEN_AFTER_SECONDS, REFRESH_IDENTITY_TOKEN_AFTER_SECONDS); - euidConfig.put("advertising_token_v4_percentage", 0); - euidConfig.put("advertising_token_v3", true); euidConfig.put("identity_v3", true); euidService = new ExtendedUIDOperatorService( @@ -148,8 +139,7 @@ private UserIdentity createUserIdentity(String rawIdentityHash, IdentityScope sc } private AdvertisingToken validateAndGetToken(EncryptedTokenEncoder tokenEncoder, String advertisingTokenString, IdentityScope scope, IdentityType type, int siteId) { - TokenVersion tokenVersion = (scope == IdentityScope.UID2) ? uid2Service.getAdvertisingTokenVersionForTests() : euidService.getAdvertisingTokenVersionForTests(); - UIDOperatorVerticleTest.validateAdvertisingToken(advertisingTokenString, tokenVersion, scope, type); + UIDOperatorVerticleTest.validateAdvertisingToken(advertisingTokenString, TokenVersion.V4, scope, type); return tokenEncoder.decodeAdvertisingToken(advertisingTokenString); } diff --git a/src/test/java/com/uid2/operator/UIDOperatorVerticleTest.java b/src/test/java/com/uid2/operator/UIDOperatorVerticleTest.java index 6ef9ba989..d9a91ae01 100644 --- a/src/test/java/com/uid2/operator/UIDOperatorVerticleTest.java +++ b/src/test/java/com/uid2/operator/UIDOperatorVerticleTest.java @@ -158,8 +158,6 @@ private void setupConfig(JsonObject config) { config.put(Const.Config.SharingTokenExpiryProp, 60 * 60 * 24 * 30); config.put("identity_scope", getIdentityScope().toString()); - config.put("advertising_token_v3", getTokenVersion() == TokenVersion.V3); - config.put("advertising_token_v4_percentage", getTokenVersion() == TokenVersion.V4 ? 100 : 0); config.put("identity_v3", useIdentityV3()); config.put("client_side_token_generate", true); config.put("key_sharing_endpoint_provide_app_names", true); @@ -665,7 +663,7 @@ private JsonObject setupIdentityMapServiceLinkTest() { return req; } - protected TokenVersion getTokenVersion() {return TokenVersion.V2;} + protected TokenVersion getTokenVersion() {return TokenVersion.V4;} final boolean useIdentityV3() { return getTokenVersion() != TokenVersion.V2; } protected IdentityScope getIdentityScope() { return IdentityScope.UID2; } diff --git a/src/test/java/com/uid2/operator/UidOperatorVerticleV4Test.java b/src/test/java/com/uid2/operator/UidOperatorVerticleV4Test.java deleted file mode 100644 index 7a040427e..000000000 --- a/src/test/java/com/uid2/operator/UidOperatorVerticleV4Test.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.uid2.operator; - -import com.uid2.shared.model.TokenVersion; - -import java.io.IOException; - -public class UidOperatorVerticleV4Test extends UIDOperatorVerticleTest { - public UidOperatorVerticleV4Test() throws IOException { - } - - @Override - protected TokenVersion getTokenVersion() {return TokenVersion.V4;} - -}