-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: fixes storage handling for non-auth recipes (#140) * fix: non auth stuff * fix: AppIdentifier * fix: interface changes * fix: multitenancy storage * fix: update add user role * fix: cleanup * fix: user role storage updates * fix: user roles * fix: version and changelog * adding dev-v5.0.0 tag to this commit to ensure building --------- Co-authored-by: rishabhpoddar <[email protected]>
- Loading branch information
1 parent
93336d8
commit 8016591
Showing
11 changed files
with
147 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
136 changes: 136 additions & 0 deletions
136
src/main/java/io/supertokens/pluginInterface/StorageUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/* | ||
* 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; | ||
|
||
import io.supertokens.pluginInterface.authRecipe.AuthRecipeStorage; | ||
import io.supertokens.pluginInterface.authRecipe.sqlStorage.AuthRecipeSQLStorage; | ||
import io.supertokens.pluginInterface.dashboard.sqlStorage.DashboardSQLStorage; | ||
import io.supertokens.pluginInterface.emailpassword.sqlStorage.EmailPasswordSQLStorage; | ||
import io.supertokens.pluginInterface.emailverification.sqlStorage.EmailVerificationSQLStorage; | ||
import io.supertokens.pluginInterface.multitenancy.MultitenancyStorage; | ||
import io.supertokens.pluginInterface.passwordless.sqlStorage.PasswordlessSQLStorage; | ||
import io.supertokens.pluginInterface.session.SessionStorage; | ||
import io.supertokens.pluginInterface.thirdparty.sqlStorage.ThirdPartySQLStorage; | ||
import io.supertokens.pluginInterface.totp.sqlStorage.TOTPSQLStorage; | ||
import io.supertokens.pluginInterface.useridmapping.UserIdMappingStorage; | ||
import io.supertokens.pluginInterface.usermetadata.sqlStorage.UserMetadataSQLStorage; | ||
import io.supertokens.pluginInterface.userroles.sqlStorage.UserRolesSQLStorage; | ||
|
||
public class StorageUtils { | ||
public static AuthRecipeSQLStorage getAuthRecipeStorage(Storage storage) { | ||
if (storage.getType() != STORAGE_TYPE.SQL) { | ||
// we only support SQL for now | ||
throw new UnsupportedOperationException(""); | ||
} | ||
|
||
return (AuthRecipeSQLStorage) storage; | ||
} | ||
|
||
public static EmailPasswordSQLStorage getEmailPasswordStorage(Storage storage) { | ||
if (storage.getType() != STORAGE_TYPE.SQL) { | ||
// we only support SQL for now | ||
throw new UnsupportedOperationException(""); | ||
} | ||
return (EmailPasswordSQLStorage) storage; | ||
} | ||
|
||
public static PasswordlessSQLStorage getPasswordlessStorage(Storage storage) { | ||
if (storage.getType() != STORAGE_TYPE.SQL) { | ||
// we only support SQL for now | ||
throw new UnsupportedOperationException(""); | ||
} | ||
return (PasswordlessSQLStorage) storage; | ||
} | ||
|
||
public static ThirdPartySQLStorage getThirdPartyStorage(Storage storage) { | ||
if (storage.getType() != STORAGE_TYPE.SQL) { | ||
// we only support SQL for now | ||
throw new UnsupportedOperationException(""); | ||
} | ||
return (ThirdPartySQLStorage) storage; | ||
} | ||
|
||
public static EmailVerificationSQLStorage getEmailVerificationStorage(Storage storage) { | ||
if (storage.getType() != STORAGE_TYPE.SQL) { | ||
// we only support SQL for now | ||
throw new UnsupportedOperationException(""); | ||
} | ||
return (EmailVerificationSQLStorage) storage; | ||
} | ||
|
||
public static SessionStorage getSessionStorage(Storage storage) { | ||
return (SessionStorage) storage; | ||
} | ||
|
||
public static UserMetadataSQLStorage getUserMetadataStorage(Storage storage) { | ||
if (storage.getType() != STORAGE_TYPE.SQL) { | ||
// we only support SQL for now | ||
throw new UnsupportedOperationException(""); | ||
} | ||
|
||
return (UserMetadataSQLStorage) storage; | ||
} | ||
|
||
public static UserIdMappingStorage getUserIdMappingStorage(Storage storage) { | ||
if (storage.getType() != STORAGE_TYPE.SQL) { | ||
// we only support SQL for now | ||
throw new UnsupportedOperationException(""); | ||
} | ||
|
||
return (UserIdMappingStorage) storage; | ||
} | ||
|
||
public static UserRolesSQLStorage getUserRolesStorage(Storage storage) { | ||
if (storage.getType() != STORAGE_TYPE.SQL) { | ||
// we only support SQL for now | ||
throw new UnsupportedOperationException(""); | ||
} | ||
return (UserRolesSQLStorage) storage; | ||
} | ||
|
||
public static DashboardSQLStorage getDashboardStorage(Storage storage) { | ||
if (storage.getType() != STORAGE_TYPE.SQL) { | ||
// we only support SQL for now | ||
throw new UnsupportedOperationException(""); | ||
} | ||
return (DashboardSQLStorage) storage; | ||
} | ||
|
||
public static TOTPSQLStorage getTOTPStorage(Storage storage) { | ||
if (storage.getType() != STORAGE_TYPE.SQL) { | ||
// we only support SQL for now | ||
throw new UnsupportedOperationException(""); | ||
} | ||
return (TOTPSQLStorage) storage; | ||
} | ||
|
||
public static ActiveUsersStorage getActiveUsersStorage(Storage storage) { | ||
if (storage.getType() != STORAGE_TYPE.SQL) { | ||
// we only support SQL for now | ||
throw new UnsupportedOperationException(""); | ||
} | ||
return (ActiveUsersStorage) storage; | ||
} | ||
|
||
public static MultitenancyStorage getMultitenancyStorage(Storage storage) { | ||
if (storage.getType() != STORAGE_TYPE.SQL) { | ||
// we only support SQL for now | ||
throw new UnsupportedOperationException(""); | ||
} | ||
return (MultitenancyStorage) storage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 0 additions & 162 deletions
162
src/main/java/io/supertokens/pluginInterface/multitenancy/AppIdentifierWithStorage.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.