Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Introduce MFA recipe in plugin interface #87

Merged
merged 108 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
5530d00
adds interface for multi tenancy
rishabhpoddar Jan 16, 2023
094f02d
changes storage layer to take json instead of config file path
rishabhpoddar Jan 19, 2023
ef6a9cc
adds new interface to indentify a user pool
rishabhpoddar Jan 19, 2023
fa8af13
exception throwing change
rishabhpoddar Jan 19, 2023
faebf7a
adds function to get connection pool ID
rishabhpoddar Jan 23, 2023
102596d
changes to interface
rishabhpoddar Jan 23, 2023
daa1089
changes to initstorage interface function
rishabhpoddar Jan 24, 2023
c4efd7d
adds function so that the core can create multiple user pools during …
rishabhpoddar Jan 28, 2023
b285355
adds tenantidentifier class
rishabhpoddar Feb 5, 2023
1227497
adds more functions to interface
rishabhpoddar Feb 7, 2023
9eacc1e
removes unused exception
rishabhpoddar Feb 7, 2023
ee8993f
small change
rishabhpoddar Feb 8, 2023
6e100b8
adds new functions
rishabhpoddar Feb 8, 2023
b7b1b50
adds deletion functions for multitenancy
rishabhpoddar Feb 9, 2023
acb2b3f
few changes
rishabhpoddar Feb 9, 2023
8bde555
updates exception class
rishabhpoddar Feb 9, 2023
75f54a5
simplifies delete of app and connectionuridomain
rishabhpoddar Feb 10, 2023
d1755a4
adds getters for certain tenant config props
rishabhpoddar Feb 11, 2023
ac4af09
adds equals functions for tenantconfig types
rishabhpoddar Feb 12, 2023
2425d18
adds constructors for thirdparty config objects
rishabhpoddar Feb 12, 2023
efac642
changes equals for tenantconfig
rishabhpoddar Feb 12, 2023
18dcc9a
removes nullable annotation from primitive type
rishabhpoddar Feb 12, 2023
d402f2d
adds tenantIdentifier for emailpassword and useridmapping recipes
rishabhpoddar Feb 13, 2023
0b15606
adds extra comment
rishabhpoddar Feb 13, 2023
2a4c598
adds comment
rishabhpoddar Feb 13, 2023
54e2a29
changes to incorporate tenantIndetifier for key value storage
rishabhpoddar Feb 14, 2023
dfb9363
changes to session receipe to add tenantIdentifier
rishabhpoddar Feb 14, 2023
0874036
introduces the concept of appIdentifier vs tenantIdentifier
rishabhpoddar Feb 15, 2023
01bf511
adds a few more functions
rishabhpoddar Feb 15, 2023
556e3cd
adds appidentifier to user metadata functions
rishabhpoddar Feb 15, 2023
49eba24
modifes user roles functions to add tenantidentifier and appidentifiers
rishabhpoddar Feb 15, 2023
3b4a43f
changes to emailpassword functions
rishabhpoddar Feb 16, 2023
6c201e9
changes to a few functions
rishabhpoddar Feb 17, 2023
d0071ed
adds appidentifier to email verfication
rishabhpoddar Feb 17, 2023
d08a59b
adds tenant identifier to third party
rishabhpoddar Feb 17, 2023
ac6c099
adds tenantidentifier to passwordless
rishabhpoddar Feb 17, 2023
976362f
function name changes
rishabhpoddar Feb 20, 2023
a36b7f6
fix: changes for multi-tenancy impl (#55)
sattvikc Feb 24, 2023
2018b3d
fix: new exceptions (#56)
sattvikc Feb 28, 2023
dcd6e96
fix: changes for random test (#57)
sattvikc Mar 2, 2023
d7c62eb
Merge branch '2.20' into multi-tenant-config
rishabhpoddar Mar 5, 2023
9b9e228
makes dashboard interface per app
rishabhpoddar Mar 5, 2023
0a1ee4b
fix: storage in AppIdentifier and TenantIdentifier (#61)
sattvikc Mar 24, 2023
35d7cde
fix: fixed pless interface (#64)
sattvikc Mar 24, 2023
0ad9103
fix: to support PR comments on core (#65)
sattvikc Mar 25, 2023
546af6a
fix: added storages to appIdentifierWithStorage (#66)
sattvikc Mar 27, 2023
d6dc7e0
fix: Multitenant userroles (#67)
sattvikc Mar 28, 2023
a9d7e0f
fix: Multitenant usermetadata (#68)
sattvikc Mar 29, 2023
77cf4f3
fix: ep storage (#69)
sattvikc Mar 29, 2023
32ff39d
fix: Multitenant uidmapping storage (#70)
sattvikc Mar 29, 2023
c91dd33
fix: Multitenant passwordless storage (#71)
sattvikc Mar 31, 2023
05cba25
fix: thirdparty storage (#72)
sattvikc Mar 31, 2023
2e97a56
fix: Multitenant thirdparty changes for update email (#73)
sattvikc Apr 1, 2023
16a9f58
fix: Multitenant emailverification storage (#74)
sattvikc Apr 3, 2023
6b01058
fix: making tokens tenant specific (#75)
sattvikc Apr 3, 2023
7acf7f5
comment modification
rishabhpoddar Apr 5, 2023
03bd13a
fix: Multitenant session (#76)
sattvikc Apr 5, 2023
a93b6b9
fix: adding tenant or app not found exceptions
sattvikc Apr 5, 2023
7d9a133
merges with latest (#77)
rishabhpoddar Apr 5, 2023
0c16056
small change
rishabhpoddar Apr 6, 2023
89bc5f7
fix: jwt changes (#78)
sattvikc Apr 6, 2023
c072fa6
fix: Multitenant Authrecipe changes (#79)
sattvikc Apr 7, 2023
525e80c
fix: Multitenant dashboard (#80)
sattvikc Apr 10, 2023
566f5a8
fix: Multitenant totp (#81)
sattvikc Apr 11, 2023
7019947
merges (#82)
rishabhpoddar Apr 13, 2023
155aa16
adds new config (#83)
rishabhpoddar Apr 18, 2023
3cd30ed
fix: multitenancy changes (#84)
sattvikc Apr 20, 2023
a67d94d
fix: base tenant (#85)
sattvikc Apr 25, 2023
eb0bf7a
feat: Introduce MFA recipe
KShivendu Apr 27, 2023
5738264
chores: Mention MFA recipe in the CHANGELOG
KShivendu Apr 27, 2023
a8537c8
fix: Tenantid in userobjects (#86)
sattvikc Apr 27, 2023
b41dd3b
fix: tenant id in loadConfig (#88)
sattvikc Apr 28, 2023
9b6a415
fix: delete non auth user (#89)
sattvikc May 2, 2023
77a78b0
feat: Improvements for EE features and removing MFA info when deletin…
KShivendu May 3, 2023
dcd65c5
fix: nonAuthRecipeuserData to take tenantIdentifier (#90)
sattvikc May 4, 2023
9a9265b
fix: pr comment
sattvikc May 4, 2023
5b95fad
fix: config validation (#91)
sattvikc May 4, 2023
45b8732
Merge branch 'multi-tenant-config' into feat/mfa
KShivendu May 9, 2023
7320125
feat: Add function to delete user from a tenant
KShivendu May 10, 2023
1f0b25f
fix: reload resources (#93)
sattvikc May 11, 2023
eec65fa
fix: added setLogLevels (#95)
sattvikc May 15, 2023
7ca0f44
Use deleteMfaInfoForuser and overload it to handle app as well as ten…
KShivendu May 15, 2023
3e37980
fix: Active user storage to extend NonAuthRecipeStorage (#97)
sattvikc May 25, 2023
9f3b681
Merge branch 'multi-tenant-config' into feat/mfa
KShivendu May 26, 2023
6e5f1ec
Merge branch 'master' into feat/mfa
KShivendu Jun 23, 2023
2986794
Merge branch 'master' into feat/mfa
KShivendu Sep 27, 2023
7dbc14f
refactor: Replace TotpNotEnabledError with UnknownUserIdTotpError (#106)
KShivendu Sep 28, 2023
e18b86a
fix: refactor transaction functions (#120)
sattvikc Oct 3, 2023
e9ab279
fix: mfa cleanup (#121)
sattvikc Oct 16, 2023
43c93f2
fix: mfa cleanup (#123)
sattvikc Oct 17, 2023
b0e49b7
Merge branch '4.0' into merge-latest
sattvikc Oct 19, 2023
31c3f89
Merge pull request #127 from supertokens/merge-latest
sattvikc Oct 19, 2023
df92365
Merge branch '4.0' into merge-latest
sattvikc Oct 20, 2023
5a5d16d
Merge pull request #129 from supertokens/merge-latest
sattvikc Oct 20, 2023
0017637
Mfa multitenancy (#122)
sattvikc Oct 26, 2023
712303d
fix: ordering in comparision
sattvikc Oct 26, 2023
3c9c754
fix: add createdat to totp device (#130)
sattvikc Oct 31, 2023
17bd7c2
fix: mfa stats (#131)
sattvikc Oct 31, 2023
e351629
Merge branch '4.0' into feat/mfa
sattvikc Nov 28, 2023
14a3276
fix: version and changelog
sattvikc Nov 29, 2023
c1fd974
fix: version
sattvikc Nov 29, 2023
208e167
fix: Mfa changes (#135)
sattvikc Dec 20, 2023
a24f17b
Merge branch '4.0' into feat/mfa
sattvikc Dec 21, 2023
93336d8
feat: Add support to update the signing key type of a session (#136)
porcellus Jan 29, 2024
8016591
merge latest (#141)
sattvikc Mar 7, 2024
51c2832
Remaining changes (#144)
sattvikc Mar 13, 2024
18411b2
merge 5.0 (#145)
sattvikc Mar 13, 2024
bd4c643
Merge branch '5.0' into feat/mfa
sattvikc Mar 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [6.0.0] - 2024-03-13

- Replace `TotpNotEnabledException` with `UnknownUserTotpIdException`
- ActiveUsersSQLStorage interface changes
- Adds `deleteUserActive_Transaction` function
- ActiveUsersStorage interface changes
- Removes `countUsersEnabledTotp`, `countUsersEnabledTotpAndActiveSince` and `deleteUserActive_Transaction` functions
- Adds `countUsersThatHaveMoreThanOneLoginMethodOrTOTPEnabledAndActiveSince` function
- AuthRecipeStorage interface changes
- Adds `getUsersCountWithMoreThanOneLoginMethodOrTOTPEnabled` function
- TenantConfig changes
- Adds `firstFactors` and `requiredSecondaryFactors` fields
- Adds `createdAt` field to `TOTPDevice`
- TOTPSQLStorage interface changes
- Adds `getDeviceByName_Transaction` and `createDevice_Transaction` functions
- Adds a new `useStaticKey` param to `updateSessionInfo_Transaction`
- This enables smooth switching between `useDynamicAccessTokenSigningKey` settings by allowing refresh calls to
change the signing key type of a session
Adds `appIdentifier` parameter to `getUserIdMappingForSuperTokensIds` in `UserIdMappingStorage`

## [5.0.0] - 2024-03-05

- Removes types `AppIdentifierWithStorage` and `TenantIdentifierWithStorage`
Expand Down Expand Up @@ -93,7 +113,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.22.0] - 2023-03-30

- Adds Support for Dashboard Search
- Adds Support for Dashboard Search

## [2.21.0] - 2023-03-27

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'java-library'
}

version = "5.0.0"
version = "6.0.0"

repositories {
mavenCentral()
Expand Down
Binary file added jar/plugin-interface-2.23.0.jar
Binary file not shown.
Binary file added jar/plugin-interface-6.0.0.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2023, 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.exceptions.StorageQueryException;
import io.supertokens.pluginInterface.multitenancy.AppIdentifier;
import io.supertokens.pluginInterface.sqlStorage.SQLStorage;
import io.supertokens.pluginInterface.sqlStorage.TransactionConnection;

public interface ActiveUsersSQLStorage extends ActiveUsersStorage, SQLStorage {
/* Delete a user from active users table */
void deleteUserActive_Transaction(TransactionConnection con, AppIdentifier appIdentifier, String userId)
throws StorageQueryException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.supertokens.pluginInterface.exceptions.StorageQueryException;
import io.supertokens.pluginInterface.multitenancy.AppIdentifier;
import io.supertokens.pluginInterface.nonAuthRecipe.NonAuthRecipeStorage;
import io.supertokens.pluginInterface.sqlStorage.TransactionConnection;

public interface ActiveUsersStorage extends NonAuthRecipeStorage {
/* Update the last active time of a user to now */
Expand All @@ -12,14 +11,7 @@ public interface ActiveUsersStorage extends NonAuthRecipeStorage {
/* Count the number of users who did some activity after given timestamp */
int countUsersActiveSince(AppIdentifier appIdentifier, long time) throws StorageQueryException;

/* Count the number of users who have enabled TOTP */
int countUsersEnabledTotp(AppIdentifier appIdentifier) throws StorageQueryException;

/* Count the number of users who have enabled TOTP and are active */
int countUsersEnabledTotpAndActiveSince(AppIdentifier appIdentifier, long time) throws StorageQueryException;

void deleteUserActive_Transaction(TransactionConnection con, AppIdentifier appIdentifier, String userId)
throws StorageQueryException;

int countUsersThatHaveMoreThanOneLoginMethodAndActiveSince(AppIdentifier appIdentifier, long sinceTime) throws StorageQueryException;

int countUsersThatHaveMoreThanOneLoginMethodOrTOTPEnabledAndActiveSince(AppIdentifier appIdentifier, long timestamp) throws StorageQueryException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
MULTITENANCY("multitenancy"), ACCOUNT_LINKING("accountlinking"), MFA("mfa");

private final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

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;
Expand Down Expand Up @@ -118,12 +117,12 @@ public static TOTPSQLStorage getTOTPStorage(Storage storage) {
return (TOTPSQLStorage) storage;
}

public static ActiveUsersStorage getActiveUsersStorage(Storage storage) {
public static ActiveUsersSQLStorage getActiveUsersStorage(Storage storage) {
if (storage.getType() != STORAGE_TYPE.SQL) {
// we only support SQL for now
throw new UnsupportedOperationException("");
}
return (ActiveUsersStorage) storage;
return (ActiveUsersSQLStorage) storage;
}

public static MultitenancyStorage getMultitenancyStorage(Storage storage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ AuthRecipeUserInfo getPrimaryUserByThirdPartyInfo(TenantIdentifier tenantIdentif
boolean checkIfUsesAccountLinking(AppIdentifier appIdentifier) throws StorageQueryException;

int getUsersCountWithMoreThanOneLoginMethod(AppIdentifier appIdentifier) throws StorageQueryException;

int getUsersCountWithMoreThanOneLoginMethodOrTOTPEnabled(AppIdentifier appIdentifier) throws StorageQueryException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;
import io.supertokens.pluginInterface.Storage;
import io.supertokens.pluginInterface.utils.Utils;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
Expand All @@ -41,17 +42,29 @@ public class TenantConfig {
@SerializedName("passwordless")
public final PasswordlessConfig passwordlessConfig;

@Nullable
@SerializedName("firstFactors")
public final String[] firstFactors;

@Nullable
@SerializedName("requiredSecondaryFactors")
public final String[] requiredSecondaryFactors;

@Nonnull
public final JsonObject coreConfig;

public TenantConfig(@Nonnull TenantIdentifier tenantIdentifier, @Nonnull EmailPasswordConfig emailPasswordConfig,
@Nonnull ThirdPartyConfig thirdPartyConfig,
@Nonnull PasswordlessConfig passwordlessConfig, @Nullable JsonObject coreConfig) {
@Nonnull PasswordlessConfig passwordlessConfig,
@Nullable String[] firstFactors, @Nullable String[] requiredSecondaryFactors,
@Nullable JsonObject coreConfig) {
this.tenantIdentifier = tenantIdentifier;
this.coreConfig = coreConfig == null ? new JsonObject() : coreConfig;
this.emailPasswordConfig = emailPasswordConfig;
this.passwordlessConfig = passwordlessConfig;
this.thirdPartyConfig = thirdPartyConfig;
this.firstFactors = firstFactors == null || firstFactors.length == 0 ? null : firstFactors;
this.requiredSecondaryFactors = requiredSecondaryFactors == null || requiredSecondaryFactors.length == 0 ? null : requiredSecondaryFactors;
}

public TenantConfig(TenantConfig other) {
Expand All @@ -62,6 +75,8 @@ public TenantConfig(TenantConfig other) {
this.emailPasswordConfig = new EmailPasswordConfig(other.emailPasswordConfig.enabled);
this.passwordlessConfig = new PasswordlessConfig(other.passwordlessConfig.enabled);
this.thirdPartyConfig = new ThirdPartyConfig(other.thirdPartyConfig.enabled, other.thirdPartyConfig.providers.clone());
this.firstFactors = other.firstFactors == null ? null : other.firstFactors.clone();
this.requiredSecondaryFactors = other.requiredSecondaryFactors == null ? null : other.requiredSecondaryFactors.clone();
}

public boolean deepEquals(TenantConfig other) {
Expand All @@ -72,6 +87,8 @@ public boolean deepEquals(TenantConfig other) {
this.emailPasswordConfig.equals(other.emailPasswordConfig) &&
this.passwordlessConfig.equals(other.passwordlessConfig) &&
this.thirdPartyConfig.equals(other.thirdPartyConfig) &&
Utils.unorderedArrayEquals(this.firstFactors, other.firstFactors) && // order is not important
Utils.unorderedArrayEquals(this.requiredSecondaryFactors, other.requiredSecondaryFactors) && // order is not important
this.coreConfig.equals(other.coreConfig);
}

Expand All @@ -94,9 +111,16 @@ public JsonObject toJson(boolean shouldProtectDbConfig, Storage storage, String[
JsonObject tenantConfigObject = gson.toJsonTree(this).getAsJsonObject();

tenantConfigObject.add("thirdParty", this.thirdPartyConfig.toJson());

tenantConfigObject.addProperty("tenantId", this.tenantIdentifier.getTenantId());

if (tenantConfigObject.has("firstFactors") && tenantConfigObject.get("firstFactors").getAsJsonArray().size() == 0) {
tenantConfigObject.remove("firstFactors");
}

if (tenantConfigObject.has("requiredSecondaryFactors") && tenantConfigObject.get("requiredSecondaryFactors").getAsJsonArray().size() == 0) {
tenantConfigObject.remove("requiredSecondaryFactors");
}

if (shouldProtectDbConfig) {
String[] protectedConfigs = storage.getProtectedConfigsFromSuperTokensSaaSUsers();
for (String config : protectedConfigs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import io.supertokens.pluginInterface.utils.Utils;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -48,38 +49,6 @@ public JsonObject toJson() {
return result;
}

public static boolean unorderedArrayEquals(Object[] array1, Object[] array2) {
if (array1 == null && array2 == null) {
return true;
} else if (array1 == null || array2 == null) {
return false;
}

List<Object> items1 = List.of(array1);
List<Object> items2 = new ArrayList<>();
items2.addAll(Arrays.asList(array2));

if (items1.size() != items2.size()) return false;

for (Object p1 : items1) {
boolean found = false;
for (Object p2 : items2) {
if (p1.equals(p2)) {
found = true;
break;
}
}

if (!found) {
return false;
} else {
items2.remove(p1);
}
}

return true;
}

public static class Provider {

@Nonnull
Expand Down Expand Up @@ -189,7 +158,7 @@ public boolean equals(Object other) {
Provider otherProvider = (Provider) other;
return Objects.equals(otherProvider.thirdPartyId, this.thirdPartyId) &&
Objects.equals(otherProvider.name, this.name) &&
unorderedArrayEquals(otherProvider.clients, this.clients) &&
Utils.unorderedArrayEquals(otherProvider.clients, this.clients) &&
Objects.equals(otherProvider.authorizationEndpoint, this.authorizationEndpoint) &&
Objects.equals(otherProvider.authorizationEndpointQueryParams,
this.authorizationEndpointQueryParams) &&
Expand Down Expand Up @@ -245,7 +214,7 @@ public boolean equals(Object other) {
return Objects.equals(otherProviderClient.clientType, this.clientType) &&
otherProviderClient.clientId.equals(this.clientId) &&
Objects.equals(otherProviderClient.clientSecret, this.clientSecret) &&
unorderedArrayEquals(otherProviderClient.scope, this.scope) &&
Utils.unorderedArrayEquals(otherProviderClient.scope, this.scope) &&
otherProviderClient.forcePKCE == this.forcePKCE &&
Objects.equals(otherProviderClient.additionalConfig, this.additionalConfig);
}
Expand Down Expand Up @@ -310,7 +279,7 @@ public boolean equals(Object other) {
if (other instanceof ThirdPartyConfig) {
ThirdPartyConfig otherThirdPartyConfig = (ThirdPartyConfig) other;
return otherThirdPartyConfig.enabled == this.enabled &&
unorderedArrayEquals(otherThirdPartyConfig.providers, this.providers);
Utils.unorderedArrayEquals(otherThirdPartyConfig.providers, this.providers);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ public interface SessionNoSQLStorage_1 extends SessionStorage, NoSQLStorage_1 {
SessionInfoWithLastUpdated getSessionInfo_Transaction(String sessionHandle) throws StorageQueryException;

boolean updateSessionInfo_Transaction(String sessionHandle, String refreshTokenHash2, long expiry,
String lastUpdatedSign) throws StorageQueryException;
String lastUpdatedSign, boolean useStaticKey) throws StorageQueryException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ SessionInfo getSessionInfo_Transaction(TenantIdentifier tenantIdentifier, Transa

void updateSessionInfo_Transaction(TenantIdentifier tenantIdentifier, TransactionConnection con,
String sessionHandle, String refreshTokenHash2,
long expiry) throws StorageQueryException;
long expiry, boolean useStaticKey) throws StorageQueryException;

void deleteSessionsOfUser_Transaction(TransactionConnection con, AppIdentifier appIdentifier, String userId)
throws StorageQueryException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ public class TOTPDevice {
public final int period;
public final int skew;
public final boolean verified;
public final long createdAt;

public TOTPDevice(String userId, String deviceName, String secretKey, int period,
int skew, boolean verified) {
int skew, boolean verified, long createdAt) {
this.userId = userId;
this.deviceName = deviceName;
this.secretKey = secretKey;
this.period = period;
this.skew = skew;
this.verified = verified;
this.createdAt = createdAt;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package io.supertokens.pluginInterface.totp.exception;

public class TotpNotEnabledException extends Exception {
public class UnknownTotpUserIdException extends Exception {
private static final long serialVersionUID = 6848053563771647272L;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import io.supertokens.pluginInterface.totp.TOTPDevice;
import io.supertokens.pluginInterface.totp.TOTPStorage;
import io.supertokens.pluginInterface.totp.TOTPUsedCode;
import io.supertokens.pluginInterface.totp.exception.TotpNotEnabledException;
import io.supertokens.pluginInterface.totp.exception.DeviceAlreadyExistsException;
import io.supertokens.pluginInterface.totp.exception.UsedCodeAlreadyExistsException;
import io.supertokens.pluginInterface.totp.exception.UnknownTotpUserIdException;

public interface TOTPSQLStorage extends TOTPStorage, SQLStorage {
public int deleteDevice_Transaction(TransactionConnection con, AppIdentifier appIdentifier, String userId,
Expand Down Expand Up @@ -38,7 +39,11 @@ public TOTPUsedCode[] getAllUsedCodesDescOrder_Transaction(TransactionConnection
* Insert a used TOTP code for an existing user:
*/
void insertUsedCode_Transaction(TransactionConnection con, TenantIdentifier tenantIdentifier, TOTPUsedCode code)
throws StorageQueryException, TotpNotEnabledException, UsedCodeAlreadyExistsException,
throws StorageQueryException, UnknownTotpUserIdException, UsedCodeAlreadyExistsException,
TenantOrAppNotFoundException;

TOTPDevice getDeviceByName_Transaction(TransactionConnection con, AppIdentifier appIdentifier, String userId, String deviceName) throws StorageQueryException;

TOTPDevice createDevice_Transaction(TransactionConnection con, AppIdentifier appIdentifier, TOTPDevice device)
throws StorageQueryException, DeviceAlreadyExistsException, TenantOrAppNotFoundException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ boolean updateOrDeleteExternalUserIdInfo(AppIdentifier appIdentifier, String use
// This function will be used to retrieve the userId mapping for a list of userIds. The key of the HashMap will be
// superTokensUserId and the value will be the externalUserId. If a mapping does not exist for an input userId,
// it will not be in a part of the returned HashMap
HashMap<String, String> getUserIdMappingForSuperTokensIds(ArrayList<String> userIds) throws StorageQueryException;
HashMap<String, String> getUserIdMappingForSuperTokensIds(AppIdentifier appIdentifier,
ArrayList<String> userIds) throws StorageQueryException;

}
Loading
Loading