-
Notifications
You must be signed in to change notification settings - Fork 13
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 (#203)
* fix: tests * fix: user role table constraint * fix: pr comments * fix: according to updated interface * fix: user roles * fix: version and changelog * fix: plugin interface version
- Loading branch information
Showing
9 changed files
with
63 additions
and
31 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
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ plugins { | |
id 'java-library' | ||
} | ||
|
||
version = "5.0.8" | ||
version = "6.0.0" | ||
|
||
repositories { | ||
mavenCentral() | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"_comment": "contains a list of plugin interfaces branch names that this core supports", | ||
"versions": [ | ||
"4.0" | ||
"5.0" | ||
] | ||
} |
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
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 |
---|---|---|
|
@@ -97,7 +97,7 @@ public void canLinkFailsIfTryingToLinkUsersAcrossDifferentStorageLayers() throws | |
AuthRecipe.createPrimaryUser(process.main, user1.getSupertokensUserId()); | ||
|
||
AuthRecipeUserInfo user2 = EmailPassword.signUp( | ||
tenantIdentifier.withStorage(StorageLayer.getStorage(tenantIdentifier, process.main)), | ||
tenantIdentifier, (StorageLayer.getStorage(tenantIdentifier, process.main)), | ||
process.getProcess(), "[email protected]", "abcd1234"); | ||
|
||
try { | ||
|
@@ -135,7 +135,7 @@ public void canLinkFailsIfTryingToLinkUsersAcrossDifferentStorageLayers() throws | |
); | ||
|
||
AuthRecipeUserInfo user3 = EmailPassword.signUp( | ||
tenantIdentifier.withStorage(StorageLayer.getStorage(tenantIdentifier, process.main)), | ||
tenantIdentifier, (StorageLayer.getStorage(tenantIdentifier, process.main)), | ||
process.getProcess(), "[email protected]", "abcd1234"); | ||
|
||
Map<String, String> params = new HashMap<>(); | ||
|
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
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 |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
import io.supertokens.multitenancy.Multitenancy; | ||
import io.supertokens.multitenancy.exception.BadPermissionException; | ||
import io.supertokens.multitenancy.exception.CannotModifyBaseConfigException; | ||
import io.supertokens.pluginInterface.Storage; | ||
import io.supertokens.pluginInterface.authRecipe.AuthRecipeUserInfo; | ||
import io.supertokens.pluginInterface.exceptions.InvalidConfigException; | ||
import io.supertokens.pluginInterface.exceptions.StorageQueryException; | ||
|
@@ -86,13 +87,13 @@ public void testUsersWorkAfterUserPoolIdChanges() throws Exception { | |
coreConfig | ||
), false); | ||
|
||
TenantIdentifierWithStorage tenantIdentifierWithStorage = tenantIdentifier.withStorage( | ||
Storage storage = ( | ||
StorageLayer.getStorage(tenantIdentifier, process.getProcess())); | ||
|
||
String userPoolId = tenantIdentifierWithStorage.getStorage().getUserPoolId(); | ||
String userPoolId = storage.getUserPoolId(); | ||
|
||
AuthRecipeUserInfo userInfo = EmailPassword.signUp( | ||
tenantIdentifierWithStorage, process.getProcess(), "[email protected]", "password"); | ||
tenantIdentifier, storage, process.getProcess(), "[email protected]", "password"); | ||
|
||
coreConfig.addProperty("postgresql_host", "127.0.0.1"); | ||
Multitenancy.addNewOrUpdateAppOrTenant(process.getProcess(), new TenantConfig( | ||
|
@@ -103,12 +104,13 @@ public void testUsersWorkAfterUserPoolIdChanges() throws Exception { | |
coreConfig | ||
), false); | ||
|
||
tenantIdentifierWithStorage = tenantIdentifier.withStorage( | ||
storage = ( | ||
StorageLayer.getStorage(tenantIdentifier, process.getProcess())); | ||
String userPoolId2 = tenantIdentifierWithStorage.getStorage().getUserPoolId(); | ||
String userPoolId2 = storage.getUserPoolId(); | ||
assertNotEquals(userPoolId, userPoolId2); | ||
|
||
AuthRecipeUserInfo user2 = EmailPassword.signIn(tenantIdentifierWithStorage, process.getProcess(), | ||
AuthRecipeUserInfo user2 = EmailPassword.signIn( | ||
tenantIdentifier, storage, process.getProcess(), | ||
"[email protected]", "password"); | ||
|
||
assertEquals(userInfo, user2); | ||
|
@@ -130,13 +132,13 @@ public void testUsersWorkAfterUserPoolIdChangesAndServerRestart() throws Excepti | |
coreConfig | ||
), false); | ||
|
||
TenantIdentifierWithStorage tenantIdentifierWithStorage = tenantIdentifier.withStorage( | ||
Storage storage = ( | ||
StorageLayer.getStorage(tenantIdentifier, process.getProcess())); | ||
|
||
String userPoolId = tenantIdentifierWithStorage.getStorage().getUserPoolId(); | ||
String userPoolId = storage.getUserPoolId(); | ||
|
||
AuthRecipeUserInfo userInfo = EmailPassword.signUp( | ||
tenantIdentifierWithStorage, process.getProcess(), "[email protected]", "password"); | ||
tenantIdentifier, storage, process.getProcess(), "[email protected]", "password"); | ||
|
||
coreConfig.addProperty("postgresql_host", "127.0.0.1"); | ||
Multitenancy.addNewOrUpdateAppOrTenant(process.getProcess(), new TenantConfig( | ||
|
@@ -153,12 +155,13 @@ public void testUsersWorkAfterUserPoolIdChangesAndServerRestart() throws Excepti | |
this.process = TestingProcessManager.start(args); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
tenantIdentifierWithStorage = tenantIdentifier.withStorage( | ||
storage = ( | ||
StorageLayer.getStorage(tenantIdentifier, process.getProcess())); | ||
String userPoolId2 = tenantIdentifierWithStorage.getStorage().getUserPoolId(); | ||
String userPoolId2 = storage.getUserPoolId(); | ||
assertNotEquals(userPoolId, userPoolId2); | ||
|
||
AuthRecipeUserInfo user2 = EmailPassword.signIn(tenantIdentifierWithStorage, process.getProcess(), | ||
AuthRecipeUserInfo user2 = EmailPassword.signIn( | ||
tenantIdentifier, storage, process.getProcess(), | ||
"[email protected]", | ||
"password"); | ||
|
||
|