Skip to content

Commit

Permalink
Merge pull request #165 from supertokens/feat/oauth/allow-list
Browse files Browse the repository at this point in the history
Feat/oauth/allow list
  • Loading branch information
porcellus authored Oct 27, 2024
2 parents b19309b + dedb65e commit 84bed30
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.supertokens.pluginInterface.oauth;

public class OAuthClient {
public final String clientId;
public final String clientSecret;
public final boolean isClientCredentialsOnly;
public final boolean enableRefreshTokenRotation;

public OAuthClient(String clientId, String clientSecret, boolean isClientCredentialsOnly, boolean enableRefreshTokenRotation) {
this.clientId = clientId;
this.clientSecret = clientSecret;
this.isClientCredentialsOnly = isClientCredentialsOnly;
this.enableRefreshTokenRotation = enableRefreshTokenRotation;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,18 @@

public interface OAuthStorage extends NonAuthRecipeStorage {

public boolean doesOAuthClientIdExist(AppIdentifier appIdentifier, String clientId) throws
StorageQueryException;
public OAuthClient getOAuthClientById(AppIdentifier appIdentifier, String clientId) throws
OAuthClientNotFoundException, StorageQueryException;

public void addOrUpdateOauthClient(AppIdentifier appIdentifier, String clientId, boolean isClientCredentialsOnly) throws TenantOrAppNotFoundException, StorageQueryException;
public void addOrUpdateOauthClient(AppIdentifier appIdentifier, String clientId, String clientSecret, boolean isClientCredentialsOnly, boolean enableRefreshTokenRotation) throws TenantOrAppNotFoundException, StorageQueryException;

public boolean deleteOAuthClient(AppIdentifier appIdentifier, String clientId) throws StorageQueryException;

public List<String> listOAuthClients(AppIdentifier appIdentifier) throws StorageQueryException;

public void revokeOAuthTokensBasedOnTargetFields(AppIdentifier appIdentifier, OAuthRevokeTargetType targetType, String targetValue, long exp) throws TenantOrAppNotFoundException, StorageQueryException;

public boolean isOAuthTokenRevokedBasedOnTargetFields(AppIdentifier appIdentifier, OAuthRevokeTargetType[] targetTypes, String[] targetValues, long issuedAt) throws StorageQueryException;
public List<OAuthClient> getOAuthClients(AppIdentifier appIdentifier, List<String> clientIds) throws StorageQueryException;

public void addOAuthM2MTokenForStats(AppIdentifier appIdentifier, String clientId, long iat, long exp) throws OAuthClientNotFoundException, StorageQueryException;

public void cleanUpExpiredAndRevokedOAuthTokensList() throws StorageQueryException;
public void deleteExpiredOAuthM2MTokens(long exp) throws StorageQueryException;

public void addOAuthLogoutChallenge(AppIdentifier appIdentifier, String challenge, String clientId, String postLogoutRedirectionUri, String sessionHandle, String state, long timeCreated) throws
DuplicateOAuthLogoutChallengeException, OAuthClientNotFoundException, StorageQueryException;
Expand All @@ -53,11 +49,30 @@ public void addOAuthLogoutChallenge(AppIdentifier appIdentifier, String challeng

public void deleteOAuthLogoutChallengesBefore(long time) throws StorageQueryException;

public void createOrUpdateOAuthSession(AppIdentifier appIdentifier, String gid, String clientId, String externalRefreshToken, String internalRefreshToken, String sessionHandle, List<String> jtis, long exp) throws StorageQueryException, OAuthClientNotFoundException;

public String getRefreshTokenMapping(AppIdentifier appIdentifier, String externalRefreshToken) throws StorageQueryException;

public void deleteExpiredOAuthSessions(long exp) throws StorageQueryException;

public int countTotalNumberOfOAuthClients(AppIdentifier appIdentifier) throws StorageQueryException;

public int countTotalNumberOfClientCredentialsOnlyOAuthClients(AppIdentifier appIdentifier) throws StorageQueryException;

public int countTotalNumberOfOAuthM2MTokensCreatedSince(AppIdentifier appIdentifier, long since) throws StorageQueryException;

public int countTotalNumberOfOAuthM2MTokensAlive(AppIdentifier appIdentifier) throws StorageQueryException;

public boolean revokeOAuthTokenByGID( AppIdentifier appIdentifier, String gid) throws StorageQueryException;

public boolean revokeOAuthTokenByClientId(AppIdentifier appIdentifier, String clientId) throws StorageQueryException;

public boolean revokeOAuthTokenBySessionHandle(AppIdentifier appIdentifier, String sessionHandle) throws StorageQueryException;

public boolean revokeOAuthTokenByJTI(AppIdentifier appIdentifier, String gid, String jti) throws StorageQueryException;

public boolean isOAuthTokenRevokedByJTI(AppIdentifier appIdentifier, String gid, String jti) throws StorageQueryException;

public boolean isOAuthTokenRevokedByGID(AppIdentifier appIdentifier, String gid) throws StorageQueryException;
}

0 comments on commit 84bed30

Please sign in to comment.