-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding delete user endpoint * Updated changelog and jsons * Updated according to new plugin interface + deleting users last * Removed rid of delete user endpoint * Added explanation about the deletion order in deletUser * Updated explanation comment * Checking if delete revoked sessions of 2nd user Co-authored-by: Mihaly Lengyel <[email protected]>
- Loading branch information
Showing
15 changed files
with
424 additions
and
4 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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
"versions": [ | ||
"2.7", | ||
"2.8", | ||
"2.9" | ||
"2.9", | ||
"2.10" | ||
] | ||
} |
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": [ | ||
"2.9" | ||
"2.10" | ||
] | ||
} |
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
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
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
60 changes: 60 additions & 0 deletions
60
src/main/java/io/supertokens/webserver/api/core/DeleteUserAPI.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,60 @@ | ||
/* | ||
* Copyright (c) 2020, 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.webserver.api.core; | ||
|
||
import java.io.IOException; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
import io.supertokens.Main; | ||
import io.supertokens.authRecipe.AuthRecipe; | ||
import io.supertokens.pluginInterface.RECIPE_ID; | ||
import io.supertokens.pluginInterface.exceptions.StorageQueryException; | ||
import io.supertokens.webserver.InputParser; | ||
import io.supertokens.webserver.WebserverAPI; | ||
|
||
public class DeleteUserAPI extends WebserverAPI { | ||
|
||
private static final long serialVersionUID = -2225750492558064634L; | ||
|
||
public DeleteUserAPI(Main main) { | ||
super(main, ""); | ||
} | ||
|
||
@Override | ||
public String getPath() { | ||
return "/user/remove"; | ||
} | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { | ||
JsonObject input = InputParser.parseJsonObjectOrThrowError(req); | ||
String userId = InputParser.parseStringOrThrowError(input, "userId", false); | ||
try { | ||
AuthRecipe.deleteUser(super.main, userId); | ||
JsonObject result = new JsonObject(); | ||
result.addProperty("status", "OK"); | ||
super.sendJsonResponse(200, result, resp); | ||
} catch (StorageQueryException e) { | ||
throw new ServletException(e); | ||
} | ||
} | ||
} |
Oops, something went wrong.