Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [7.1.1]

- Adds support for BulkImportUser's id generation while the upload is happening

## [7.1.0]

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 = "7.1.0"
version = "7.1.1"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package io.supertokens.pluginInterface.bulkimport;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import io.supertokens.pluginInterface.bulkimport.BulkImportStorage.BULK_IMPORT_USER_STATUS;

Expand Down Expand Up @@ -86,6 +87,38 @@ public JsonObject toJsonObject() {
return gson.fromJson(gson.toJson(this), JsonObject.class);
}

public JsonObject toResponseJson(){
JsonObject response = new JsonObject();
response.addProperty("userId", externalUserId == null ? id : externalUserId);
JsonArray loginArray = new JsonArray();
for(LoginMethod loginMethod: loginMethods){
JsonObject lmObj = new JsonObject();
lmObj.addProperty("recipeId", loginMethod.recipeId);
lmObj.addProperty("userId", loginMethod.getSuperTokenOrExternalUserId());
lmObj.add("tenants", gson.toJsonTree(loginMethod.tenantIds));
switch (loginMethod.recipeId) {
case "emailpassword": {
lmObj.addProperty("email", loginMethod.email);
break;
}
case "thirdparty": {
lmObj.addProperty("email", loginMethod.email);
lmObj.addProperty("thirdpartyId", loginMethod.thirdPartyId);
lmObj.addProperty("thirdpartyUserId", loginMethod.thirdPartyUserId);
break;
}
case "passwordless": {
lmObj.addProperty("email", loginMethod.email);
lmObj.addProperty("phoneNumber", loginMethod.phoneNumber);
break;
}
}
loginArray.add(lmObj);
}
response.add("loginMethods", loginArray);
return response;
}

public static class UserRole {
public String role;
public List<String> tenantIds;
Expand Down Expand Up @@ -132,7 +165,7 @@ public String getSuperTokenOrExternalUserId() {

public LoginMethod(List<String> tenantIds, String recipeId, boolean isVerified, boolean isPrimary,
long timeJoinedInMSSinceEpoch, String email, String passwordHash, String hashingAlgorithm, String plainTextPassword,
String thirdPartyId, String thirdPartyUserId, String phoneNumber) {
String thirdPartyId, String thirdPartyUserId, String phoneNumber, String superTokensUserId) {
this.tenantIds = tenantIds;
this.recipeId = recipeId;
this.isVerified = isVerified;
Expand All @@ -145,6 +178,7 @@ public LoginMethod(List<String> tenantIds, String recipeId, boolean isVerified,
this.thirdPartyId = thirdPartyId;
this.thirdPartyUserId = thirdPartyUserId;
this.phoneNumber = phoneNumber;
this.superTokensUserId = superTokensUserId;
}
}
}