diff --git a/src/main/java/io/supertokens/Main.java b/src/main/java/io/supertokens/Main.java index 105a7f9ca..2681a3743 100644 --- a/src/main/java/io/supertokens/Main.java +++ b/src/main/java/io/supertokens/Main.java @@ -20,7 +20,7 @@ import io.supertokens.config.Config; import io.supertokens.config.CoreConfig; import io.supertokens.cronjobs.Cronjobs; -import io.supertokens.cronjobs.cleanupOAuthRevokeListAndChallenges.CleanupOAuthSessionsAndChallenges; +import io.supertokens.cronjobs.cleanupOAuthSessionsAndChallenges.CleanupOAuthSessionsAndChallenges; import io.supertokens.cronjobs.deleteExpiredAccessTokenSigningKeys.DeleteExpiredAccessTokenSigningKeys; import io.supertokens.cronjobs.deleteExpiredDashboardSessions.DeleteExpiredDashboardSessions; import io.supertokens.cronjobs.deleteExpiredEmailVerificationTokens.DeleteExpiredEmailVerificationTokens; diff --git a/src/main/java/io/supertokens/cronjobs/cleanupOAuthRevokeListAndChallenges/CleanupOAuthSessionsAndChallenges.java b/src/main/java/io/supertokens/cronjobs/cleanupOAuthSessionsAndChallenges/CleanupOAuthSessionsAndChallenges.java similarity index 89% rename from src/main/java/io/supertokens/cronjobs/cleanupOAuthRevokeListAndChallenges/CleanupOAuthSessionsAndChallenges.java rename to src/main/java/io/supertokens/cronjobs/cleanupOAuthSessionsAndChallenges/CleanupOAuthSessionsAndChallenges.java index 495007b47..9787618e6 100644 --- a/src/main/java/io/supertokens/cronjobs/cleanupOAuthRevokeListAndChallenges/CleanupOAuthSessionsAndChallenges.java +++ b/src/main/java/io/supertokens/cronjobs/cleanupOAuthSessionsAndChallenges/CleanupOAuthSessionsAndChallenges.java @@ -1,4 +1,4 @@ -package io.supertokens.cronjobs.cleanupOAuthRevokeListAndChallenges; +package io.supertokens.cronjobs.cleanupOAuthSessionsAndChallenges; import io.supertokens.Main; import io.supertokens.cronjobs.CronTask; @@ -13,11 +13,11 @@ public class CleanupOAuthSessionsAndChallenges extends CronTask { - public static final String RESOURCE_KEY = "io.supertokens.cronjobs.cleanupOAuthRevokeListAndChallenges" + - ".CleanupOAuthRevokeListAndChallenges"; + public static final String RESOURCE_KEY = "io.supertokens.cronjobs.cleanupOAuthSessionsAndChallenges" + + ".CleanupOAuthSessionsAndChallenges"; private CleanupOAuthSessionsAndChallenges(Main main, List> tenantsInfo) { - super("CleanupOAuthRevokeList", main, tenantsInfo, true); + super("CleanupOAuthSessionsAndChallenges", main, tenantsInfo, true); } public static CleanupOAuthSessionsAndChallenges init(Main main, List> tenantsInfo) { diff --git a/src/test/java/io/supertokens/test/CronjobTest.java b/src/test/java/io/supertokens/test/CronjobTest.java index 61de7d07e..dc3a557bd 100644 --- a/src/test/java/io/supertokens/test/CronjobTest.java +++ b/src/test/java/io/supertokens/test/CronjobTest.java @@ -1049,7 +1049,7 @@ public void testThatThereAreTasksOfAllCronTaskClassesAndHaveCorrectIntervals() t intervals.put("io.supertokens.cronjobs.telemetry.Telemetry", 86400); intervals.put("io.supertokens.cronjobs.deleteExpiredAccessTokenSigningKeys.DeleteExpiredAccessTokenSigningKeys", 86400); - intervals.put("io.supertokens.cronjobs.cleanupOAuthRevokeListAndChallenges.CleanupOAuthRevokeListAndChallenges", + intervals.put("io.supertokens.cronjobs.cleanupOAuthSessionsAndChallenges.CleanupOAuthSessionsAndChallenges", 86400); Map delays = new HashMap<>(); @@ -1065,7 +1065,7 @@ public void testThatThereAreTasksOfAllCronTaskClassesAndHaveCorrectIntervals() t delays.put("io.supertokens.cronjobs.telemetry.Telemetry", 0); delays.put("io.supertokens.cronjobs.deleteExpiredAccessTokenSigningKeys.DeleteExpiredAccessTokenSigningKeys", 0); - delays.put("io.supertokens.cronjobs.cleanupOAuthRevokeListAndChallenges.CleanupOAuthRevokeListAndChallenges", + delays.put("io.supertokens.cronjobs.cleanupOAuthSessionsAndChallenges.CleanupOAuthSessionsAndChallenges", 0); List allTasks = Cronjobs.getInstance(process.getProcess()).getTasks(); diff --git a/src/test/java/io/supertokens/test/multitenant/TestAppData.java b/src/test/java/io/supertokens/test/multitenant/TestAppData.java index e4d38b37c..c06979fd4 100644 --- a/src/test/java/io/supertokens/test/multitenant/TestAppData.java +++ b/src/test/java/io/supertokens/test/multitenant/TestAppData.java @@ -59,6 +59,7 @@ import java.time.Duration; import java.time.Instant; import java.util.Arrays; +import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -100,6 +101,7 @@ public void testThatDeletingAppDeleteDataFromAllTables() throws Exception { FeatureFlagTestContent.getInstance(process.getProcess()) .setKeyValue(FeatureFlagTestContent.ENABLED_FEATURES, new EE_FEATURES[]{EE_FEATURES.MULTI_TENANCY, EE_FEATURES.MFA}); + Utils.setValueInConfig("oauth_client_secret_encryption_key", "secret"); process.startProcess(); assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); @@ -181,6 +183,7 @@ null, null, new JsonObject() OAuth.createLogoutRequestAndReturnRedirectUri(process.getProcess(), app.toAppIdentifier(), appStorage, "test", "http://localhost", "sessionHandle", "state"); ((OAuthStorage) appStorage).addOAuthM2MTokenForStats(app.toAppIdentifier(), "test", 1000, 2000); OAuth.revokeSessionHandle(process.getProcess(), app.toAppIdentifier(), appStorage, "sessionHandle"); + OAuth.createOrUpdateOauthSession(process.getProcess(), app.toAppIdentifier(), appStorage, "test", "test-gid", null, null, "sessionHandle", List.of("jti"), 0); String[] tablesThatHaveData = appStorage .getAllTablesInTheDatabaseThatHasDataForAppId(app.getAppId());