@@ -153,11 +153,6 @@ void deployVerticle(Vertx vertx, VertxTestContext testContext, TestInfo testInfo
153153
154154 setupConfig (config );
155155 runtimeConfig = setupRuntimeConfig (config );
156- // TODO: Remove this when we remove tokenGenerateOptOutTokenWithDisableOptoutTokenFF test
157- if (testInfo .getTestMethod ().isPresent () &&
158- testInfo .getTestMethod ().get ().getName ().equals ("tokenGenerateOptOutTokenWithDisableOptoutTokenFF" )) {
159- config .put (Const .Config .DisableOptoutTokenProp , true );
160- }
161156 if (testInfo .getDisplayName ().equals ("cstgNoPhoneSupport(Vertx, VertxTestContext)" )) {
162157 config .put ("enable_phone_support" , false );
163158 }
@@ -201,7 +196,6 @@ private void setupConfig(JsonObject config) {
201196 config .put (Const .Config .AllowClockSkewSecondsProp , 3600 );
202197 config .put (Const .Config .OptOutStatusApiEnabled , true );
203198 config .put (Const .Config .OptOutStatusMaxRequestSize , optOutStatusMaxRequestSize );
204- config .put (Const .Config .DisableOptoutTokenProp , false );
205199 config .put (Const .Config .ConfigScanPeriodMsProp , 10000 );
206200 }
207201
@@ -1366,47 +1360,6 @@ void v3IdentityMapOutdatedRefreshFrom(Vertx vertx, VertxTestContext testContext)
13661360 });
13671361 }
13681362
1369- @ Test
1370- void tokenGenerateNewClientNoPolicySpecified (Vertx vertx , VertxTestContext testContext ) {
1371- final int clientSiteId = 201 ;
1372- fakeAuth (clientSiteId , newClientCreationDateTime , Role .GENERATOR );
1373- setupSalts ();
1374- setupKeys ();
1375-
1376- JsonObject v2Payload = new JsonObject ();
1377- v2Payload .put ("email" , "test@email.com" );
1378-
1379- sendTokenGenerate (vertx , v2Payload , 400 ,
1380- json -> {
1381- assertFalse (json .containsKey ("body" ));
1382- assertEquals ("client_error" , json .getString ("status" ));
1383- assertEquals ("Required opt-out policy argument for token/generate is missing or not set to 1" , json .getString ("message" ));
1384- testContext .completeNow ();
1385- });
1386- }
1387-
1388- @ ParameterizedTest
1389- @ ValueSource (strings = {"policy" , "optout_check" })
1390- void tokenGenerateNewClientWrongPolicySpecified (String policyParamterKey , Vertx vertx , VertxTestContext testContext ) {
1391- final int clientSiteId = 201 ;
1392- fakeAuth (clientSiteId , newClientCreationDateTime , Role .GENERATOR );
1393- setupSalts ();
1394- setupKeys ();
1395-
1396- JsonObject v2Payload = new JsonObject ();
1397- v2Payload .put ("email" , "test@email.com" );
1398- v2Payload .put (policyParamterKey , OptoutCheckPolicy .DoNotRespect .policy );
1399-
1400- sendTokenGenerate (vertx ,
1401- v2Payload , 400 ,
1402- json -> {
1403- assertFalse (json .containsKey ("body" ));
1404- assertEquals ("client_error" , json .getString ("status" ));
1405- assertEquals ("Required opt-out policy argument for token/generate is missing or not set to 1" , json .getString ("message" ));
1406- testContext .completeNow ();
1407- });
1408- }
1409-
14101363 @ Test
14111364 void tokenGenerateNewClientNoPolicySpecifiedOlderKeySuccessful (Vertx vertx , VertxTestContext testContext ) {
14121365 ClientKey newClientKey = new ClientKey (
@@ -1489,130 +1442,6 @@ void tokenGenerateNewClientWrongPolicySpecifiedOlderKeySuccessful(String policyP
14891442 });
14901443 }
14911444
1492- @ ParameterizedTest // TODO: remove test after optout check phase 3
1493- @ CsvSource ({
1494- "policy,someoptout@example.com,Email" ,
1495- "policy,+01234567890,Phone" ,
1496- "optout_check,someoptout@example.com,Email" ,
1497- "optout_check,+01234567890,Phone"
1498- })
1499- void tokenGenerateOptOutToken (String policyParameterKey , String identity , IdentityType identityType ,
1500- Vertx vertx , VertxTestContext testContext ) {
1501- ClientKey oldClientKey = new ClientKey (
1502- null ,
1503- null ,
1504- Utils .toBase64String (clientSecret ),
1505- "test-contact" ,
1506- newClientCreationDateTime .minusSeconds (5 ),
1507- Set .of (Role .GENERATOR ),
1508- 201 ,
1509- null
1510- );
1511- when (clientKeyProvider .get (any ())).thenReturn (oldClientKey );
1512- when (clientKeyProvider .getClientKey (any ())).thenReturn (oldClientKey );
1513- when (clientKeyProvider .getOldestClientKey (201 )).thenReturn (oldClientKey );
1514- when (this .optOutStore .getLatestEntry (any ())).thenReturn (Instant .now ());
1515- setupSalts ();
1516- setupKeys ();
1517-
1518- JsonObject v2Payload = new JsonObject ();
1519- v2Payload .put (identityType .name ().toLowerCase (), identity );
1520- v2Payload .put (policyParameterKey , OptoutCheckPolicy .DoNotRespect .policy );
1521-
1522- sendTokenGenerate (vertx ,
1523- v2Payload , 200 ,
1524- json -> {
1525- InputUtil .InputVal optOutTokenInput = identityType == IdentityType .Email ?
1526- InputUtil .InputVal .validEmail (OptOutTokenIdentityForEmail , OptOutTokenIdentityForEmail ) :
1527- InputUtil .InputVal .validPhone (OptOutIdentityForPhone , OptOutTokenIdentityForPhone );
1528-
1529- assertEquals ("success" , json .getString ("status" ));
1530-
1531- JsonObject body = json .getJsonObject ("body" );
1532- assertNotNull (body );
1533-
1534- decodeV2RefreshToken (json );
1535-
1536- AdvertisingToken advertisingToken = validateAndGetToken (encoder , body , identityType );
1537- RefreshToken refreshToken = encoder .decodeRefreshToken (body .getString ("decrypted_refresh_token" ));
1538- final byte [] advertisingId = getAdvertisingIdFromIdentity (identityType ,
1539- optOutTokenInput .getNormalized (),
1540- firstLevelSalt ,
1541- rotatingSalt123 .currentSalt ());
1542- final byte [] firstLevelHash = TokenUtils .getFirstLevelHashFromIdentity (optOutTokenInput .getNormalized (), firstLevelSalt );
1543- assertArrayEquals (advertisingId , advertisingToken .userIdentity .id );
1544- assertArrayEquals (firstLevelHash , refreshToken .userIdentity .id );
1545-
1546- assertFalse (PrivacyBits .fromInt (advertisingToken .userIdentity .privacyBits ).isClientSideTokenGenerated ());
1547- assertTrue (PrivacyBits .fromInt (advertisingToken .userIdentity .privacyBits ).isClientSideTokenOptedOut ());
1548-
1549- assertTokenStatusMetrics (
1550- 201 ,
1551- TokenResponseStatsCollector .Endpoint .GenerateV2 ,
1552- TokenResponseStatsCollector .ResponseStatus .Success ,
1553- TokenResponseStatsCollector .PlatformType .Other );
1554-
1555- sendTokenRefresh (vertx , testContext , body .getString ("refresh_token" ), body .getString ("refresh_response_key" ), 200 , refreshRespJson -> {
1556- assertEquals ("optout" , refreshRespJson .getString ("status" ));
1557- JsonObject refreshBody = refreshRespJson .getJsonObject ("body" );
1558- assertNull (refreshBody );
1559- assertTokenStatusMetrics (
1560- 201 ,
1561- TokenResponseStatsCollector .Endpoint .RefreshV2 ,
1562- TokenResponseStatsCollector .ResponseStatus .OptOut ,
1563- TokenResponseStatsCollector .PlatformType .InApp );
1564- testContext .completeNow ();
1565- }, Map .of (ClientVersionHeader , tvosClientVersionHeaderValue ));
1566- });
1567- }
1568-
1569- @ ParameterizedTest // TODO: remove test after optout check phase 3
1570- @ CsvSource ({
1571- "policy,someoptout@example.com,Email" ,
1572- "policy,+01234567890,Phone" ,
1573- "optout_check,someoptout@example.com,Email" ,
1574- "optout_check,+01234567890,Phone"
1575- })
1576- void tokenGenerateOptOutTokenWithDisableOptoutTokenFF (String policyParameterKey , String identity , IdentityType identityType ,
1577- Vertx vertx , VertxTestContext testContext ) {
1578- ClientKey oldClientKey = new ClientKey (
1579- null ,
1580- null ,
1581- Utils .toBase64String (clientSecret ),
1582- "test-contact" ,
1583- newClientCreationDateTime .minusSeconds (5 ),
1584- Set .of (Role .GENERATOR ),
1585- 201 ,
1586- null
1587- );
1588- when (clientKeyProvider .get (any ())).thenReturn (oldClientKey );
1589- when (clientKeyProvider .getClientKey (any ())).thenReturn (oldClientKey );
1590- when (clientKeyProvider .getOldestClientKey (201 )).thenReturn (oldClientKey );
1591- when (this .optOutStore .getLatestEntry (any ())).thenReturn (Instant .now ());
1592- setupSalts ();
1593- setupKeys ();
1594-
1595- JsonObject v2Payload = new JsonObject ();
1596- v2Payload .put (identityType .name ().toLowerCase (), identity );
1597- v2Payload .put (policyParameterKey , OptoutCheckPolicy .DoNotRespect .policy );
1598-
1599- sendTokenGenerate (vertx ,
1600- v2Payload , 200 ,
1601- json -> {
1602- assertEquals ("optout" , json .getString ("status" ));
1603-
1604- decodeV2RefreshToken (json );
1605-
1606- assertTokenStatusMetrics (
1607- 201 ,
1608- TokenResponseStatsCollector .Endpoint .GenerateV2 ,
1609- TokenResponseStatsCollector .ResponseStatus .OptOut ,
1610- TokenResponseStatsCollector .PlatformType .Other );
1611-
1612- testContext .completeNow ();
1613- });
1614- }
1615-
16161445 @ ParameterizedTest
16171446 @ CsvSource ({
16181447 "true,text/plain" ,
0 commit comments