diff --git a/src/main/java/io/supertokens/pluginInterface/RECIPE_ID.java b/src/main/java/io/supertokens/pluginInterface/RECIPE_ID.java index 6aee253f..d9d0848f 100644 --- a/src/main/java/io/supertokens/pluginInterface/RECIPE_ID.java +++ b/src/main/java/io/supertokens/pluginInterface/RECIPE_ID.java @@ -22,7 +22,7 @@ public enum RECIPE_ID { EMAIL_PASSWORD("emailpassword"), THIRD_PARTY("thirdparty"), SESSION("session"), EMAIL_VERIFICATION("emailverification"), JWT("jwt"), PASSWORDLESS("passwordless"), USER_METADATA("usermetadata"), USER_ROLES("userroles"), USER_ID_MAPPING("useridmapping"), DASHBOARD("dashboard"), TOTP("totp"), - MULTITENANCY("multitenancy"), ACCOUNT_LINKING("accountlinking"), MFA("mfa"); + MULTITENANCY("multitenancy"), ACCOUNT_LINKING("accountlinking"), MFA("mfa"), OAUTH("oauth"); private final String name; diff --git a/src/main/java/io/supertokens/pluginInterface/oauth/OAuthStorage.java b/src/main/java/io/supertokens/pluginInterface/oauth/OAuthStorage.java index 31c0089f..de6e8d86 100644 --- a/src/main/java/io/supertokens/pluginInterface/oauth/OAuthStorage.java +++ b/src/main/java/io/supertokens/pluginInterface/oauth/OAuthStorage.java @@ -16,9 +16,18 @@ package io.supertokens.pluginInterface.oauth; +import io.supertokens.pluginInterface.exceptions.StorageQueryException; import io.supertokens.pluginInterface.multitenancy.AppIdentifier; import io.supertokens.pluginInterface.nonAuthRecipe.NonAuthRecipeStorage; +import io.supertokens.pluginInterface.oauth.exceptions.OAuth2ClientAlreadyExistsForAppException; public interface OAuthStorage extends NonAuthRecipeStorage { - public boolean doesClientIdExistForThisApp(AppIdentifier appIdentifier, String clientId); + + public boolean doesClientIdExistForThisApp(AppIdentifier appIdentifier, String clientId) throws + StorageQueryException; + + public void addClientForApp(AppIdentifier appIdentifier, String clientId) throws StorageQueryException, + OAuth2ClientAlreadyExistsForAppException; + + public boolean removeAppClientAssociation(AppIdentifier appIdentifier, String clientId) throws StorageQueryException; } diff --git a/src/main/java/io/supertokens/pluginInterface/oauth/exceptions/OAuth2ClientAlreadyExistsForAppException.java b/src/main/java/io/supertokens/pluginInterface/oauth/exceptions/OAuth2ClientAlreadyExistsForAppException.java new file mode 100644 index 00000000..e7521a44 --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/oauth/exceptions/OAuth2ClientAlreadyExistsForAppException.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package io.supertokens.pluginInterface.oauth.exceptions; + +import java.io.Serial; + +public class OAuth2ClientAlreadyExistsForAppException extends Exception{ + @Serial + private static final long serialVersionUID = 2792232552559552544L; +} diff --git a/src/main/java/io/supertokens/pluginInterface/oauth/sqlStorage/OAuthSQLStorage.java b/src/main/java/io/supertokens/pluginInterface/oauth/sqlStorage/OAuthSQLStorage.java new file mode 100644 index 00000000..df28bdef --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/oauth/sqlStorage/OAuthSQLStorage.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package io.supertokens.pluginInterface.oauth.sqlStorage; + +import io.supertokens.pluginInterface.oauth.OAuthStorage; +import io.supertokens.pluginInterface.sqlStorage.SQLStorage; + +public interface OAuthSQLStorage extends OAuthStorage, SQLStorage { + +}