From a31096d5662e164957cefd3aaa073885a36b5620 Mon Sep 17 00:00:00 2001 From: Sattvik Chakravarthy Date: Thu, 26 Sep 2024 12:03:43 +0530 Subject: [PATCH 1/2] fix: logout --- .../oauth/OAuthLogoutChallenge.java | 19 +++++++++++++++++++ .../pluginInterface/oauth/OAuthStorage.java | 8 ++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/main/java/io/supertokens/pluginInterface/oauth/OAuthLogoutChallenge.java diff --git a/src/main/java/io/supertokens/pluginInterface/oauth/OAuthLogoutChallenge.java b/src/main/java/io/supertokens/pluginInterface/oauth/OAuthLogoutChallenge.java new file mode 100644 index 00000000..1bed85ab --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/oauth/OAuthLogoutChallenge.java @@ -0,0 +1,19 @@ +package io.supertokens.pluginInterface.oauth; + +public class OAuthLogoutChallenge { + public final String challenge; + public final String clientId; + public final String postLogoutRedirectionUri; + public final String gid; + public final String state; + public final long timeCreated; + + public OAuthLogoutChallenge(String challenge, String clientId, String postLogoutRedirectionUri, String gid, String state, long timeCreated) { + this.challenge = challenge; + this.clientId = clientId; + this.postLogoutRedirectionUri = postLogoutRedirectionUri; + this.gid = gid; + this.state = state; + this.timeCreated = timeCreated; + } +} diff --git a/src/main/java/io/supertokens/pluginInterface/oauth/OAuthStorage.java b/src/main/java/io/supertokens/pluginInterface/oauth/OAuthStorage.java index 94cb5e78..a840034f 100644 --- a/src/main/java/io/supertokens/pluginInterface/oauth/OAuthStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/oauth/OAuthStorage.java @@ -48,4 +48,12 @@ public boolean doesClientIdExistForApp(AppIdentifier appIdentifier, String clien public int countTotalNumberOfM2MTokensAlive(AppIdentifier appIdentifier) throws StorageQueryException; public void cleanUpExpiredAndRevokedTokens(AppIdentifier appIdentifier) throws StorageQueryException; + + public void addLogoutChallenge(AppIdentifier appIdentifier, String challenge, String clientId, String postLogoutRedirectionUri, String state, long timeCreated) throws StorageQueryException; + + public OAuthLogoutChallenge getLogoutChallenge(AppIdentifier appIdentifier, String challenge) throws StorageQueryException; + + public void deleteLogoutChallenge(AppIdentifier appIdentifier, String challenge) throws StorageQueryException; + + public void deleteLogoutChallengesBefore(AppIdentifier appIdentifier, long time) throws StorageQueryException; } From 69137da1215e5b96a8b217814616de33b5705359 Mon Sep 17 00:00:00 2001 From: Sattvik Chakravarthy Date: Thu, 26 Sep 2024 14:57:25 +0530 Subject: [PATCH 2/2] fix: session revoke in logout --- .../pluginInterface/oauth/OAuthLogoutChallenge.java | 6 +++--- .../io/supertokens/pluginInterface/oauth/OAuthStorage.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/supertokens/pluginInterface/oauth/OAuthLogoutChallenge.java b/src/main/java/io/supertokens/pluginInterface/oauth/OAuthLogoutChallenge.java index 1bed85ab..ca453367 100644 --- a/src/main/java/io/supertokens/pluginInterface/oauth/OAuthLogoutChallenge.java +++ b/src/main/java/io/supertokens/pluginInterface/oauth/OAuthLogoutChallenge.java @@ -4,15 +4,15 @@ public class OAuthLogoutChallenge { public final String challenge; public final String clientId; public final String postLogoutRedirectionUri; - public final String gid; + public final String sessionHandle; public final String state; public final long timeCreated; - public OAuthLogoutChallenge(String challenge, String clientId, String postLogoutRedirectionUri, String gid, String state, long timeCreated) { + public OAuthLogoutChallenge(String challenge, String clientId, String postLogoutRedirectionUri, String sessionHandle, String state, long timeCreated) { this.challenge = challenge; this.clientId = clientId; this.postLogoutRedirectionUri = postLogoutRedirectionUri; - this.gid = gid; + this.sessionHandle = sessionHandle; this.state = state; this.timeCreated = timeCreated; } diff --git a/src/main/java/io/supertokens/pluginInterface/oauth/OAuthStorage.java b/src/main/java/io/supertokens/pluginInterface/oauth/OAuthStorage.java index a840034f..941eca86 100644 --- a/src/main/java/io/supertokens/pluginInterface/oauth/OAuthStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/oauth/OAuthStorage.java @@ -49,7 +49,7 @@ public boolean doesClientIdExistForApp(AppIdentifier appIdentifier, String clien public void cleanUpExpiredAndRevokedTokens(AppIdentifier appIdentifier) throws StorageQueryException; - public void addLogoutChallenge(AppIdentifier appIdentifier, String challenge, String clientId, String postLogoutRedirectionUri, String state, long timeCreated) throws StorageQueryException; + public void addLogoutChallenge(AppIdentifier appIdentifier, String challenge, String clientId, String postLogoutRedirectionUri, String sessionHandle, String state, long timeCreated) throws StorageQueryException; public OAuthLogoutChallenge getLogoutChallenge(AppIdentifier appIdentifier, String challenge) throws StorageQueryException;