diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cf4577bc..6aec46eea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,61 +10,66 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [9.4.0] ### Added + - Adds property `bulk_migration_parallelism` for fine-tuning the worker threads number - Adds APIs to bulk import users - - GET `/bulk-import/users` - - POST `/bulk-import/users` - - GET `/bulk-import/users/count` - - POST `/bulk-import/users/remove` - - POST `/bulk-import/users/import` + - GET `/bulk-import/users` + - POST `/bulk-import/users` + - GET `/bulk-import/users/count` + - POST `/bulk-import/users/remove` + - POST `/bulk-import/users/import` - Adds `ProcessBulkImportUsers` cron job to process bulk import users - Adds multithreaded worker support for the `ProcessBulkImportUsers` cron job for faster bulk imports - Adds support for lazy importing users +### Breaking changes + +- Includes CUD in the owner field for OAuth clients + ### Migrations For PostgreSQL, run the following SQL script: + ```sql -"CREATE TABLE IF NOT EXISTS bulk_import_users ( - id CHAR(36), - app_id VARCHAR(64) NOT NULL DEFAULT 'public', - primary_user_id VARCHAR(36), - raw_data TEXT NOT NULL, - status VARCHAR(128) DEFAULT 'NEW', - error_msg TEXT, - created_at BIGINT NOT NULL, - updated_at BIGINT NOT NULL, - CONSTRAINT bulk_import_users_pkey PRIMARY KEY(app_id, id), - CONSTRAINT bulk_import_users__app_id_fkey FOREIGN KEY(app_id) REFERENCES apps(app_id) ON DELETE CASCADE +CREATE TABLE IF NOT EXISTS bulk_import_users ( + id CHAR(36), + app_id VARCHAR(64) NOT NULL DEFAULT 'public', + primary_user_id VARCHAR(36), + raw_data TEXT NOT NULL, + status VARCHAR(128) DEFAULT 'NEW', + error_msg TEXT, + created_at BIGINT NOT NULL, + updated_at BIGINT NOT NULL, + CONSTRAINT bulk_import_users_pkey PRIMARY KEY(app_id, id), + CONSTRAINT bulk_import_users__app_id_fkey FOREIGN KEY(app_id) REFERENCES apps(app_id) ON DELETE CASCADE ); CREATE INDEX IF NOT EXISTS bulk_import_users_status_updated_at_index ON bulk_import_users (app_id, status, updated_at); -CREATE INDEX IF NOT EXISTS bulk_import_users_pagination_index1 ON bulk_import_users (app_id, status, created_at DESC, - id DESC); +CREATE INDEX IF NOT EXISTS bulk_import_users_pagination_index1 ON bulk_import_users (app_id, status, created_at DESC, id DESC); CREATE INDEX IF NOT EXISTS bulk_import_users_pagination_index2 ON bulk_import_users (app_id, created_at DESC, id DESC); ``` For MySQL run the following SQL script: + ```sql CREATE TABLE IF NOT EXISTS bulk_import_users ( - id CHAR(36), - app_id VARCHAR(64) NOT NULL DEFAULT 'public', - primary_user_id VARCHAR(36), - raw_data TEXT NOT NULL, - status VARCHAR(128) DEFAULT 'NEW', - error_msg TEXT, - created_at BIGINT UNSIGNED NOT NULL, - updated_at BIGINT UNSIGNED NOT NULL, - PRIMARY KEY (app_id, id), - FOREIGN KEY(app_id) REFERENCES apps(app_id) ON DELETE CASCADE + id CHAR(36), + app_id VARCHAR(64) NOT NULL DEFAULT 'public', + primary_user_id VARCHAR(36), + raw_data TEXT NOT NULL, + status VARCHAR(128) DEFAULT 'NEW', + error_msg TEXT, + created_at BIGINT UNSIGNED NOT NULL, + updated_at BIGINT UNSIGNED NOT NULL, + PRIMARY KEY (app_id, id), + FOREIGN KEY(app_id) REFERENCES apps(app_id) ON DELETE CASCADE ); CREATE INDEX bulk_import_users_status_updated_at_index ON bulk_import_users (app_id, status, updated_at); -CREATE INDEX bulk_import_users_pagination_index1 ON bulk_import_users (app_id, status, created_at DESC, - id DESC); +CREATE INDEX bulk_import_users_pagination_index1 ON bulk_import_users (app_id, status, created_at DESC, id DESC); CREATE INDEX bulk_import_users_pagination_index2 ON bulk_import_users (app_id, created_at DESC, id DESC); ``` diff --git a/src/main/java/io/supertokens/webserver/api/oauth/CreateUpdateOrGetOAuthClientAPI.java b/src/main/java/io/supertokens/webserver/api/oauth/CreateUpdateOrGetOAuthClientAPI.java index a4e5e4c54..b5a08a502 100644 --- a/src/main/java/io/supertokens/webserver/api/oauth/CreateUpdateOrGetOAuthClientAPI.java +++ b/src/main/java/io/supertokens/webserver/api/oauth/CreateUpdateOrGetOAuthClientAPI.java @@ -130,7 +130,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws I AppIdentifier appIdentifier = getAppIdentifier(req); Storage storage = enforcePublicTenantAndGetPublicTenantStorage(req); - input.addProperty("owner", appIdentifier.getAppId()); + input.addProperty("owner", appIdentifier.getConnectionUriDomain() + "_" + appIdentifier.getAppId()); HttpRequestForOAuthProvider.Response response = OAuthProxyHelper.proxyJsonPOST( main, req, resp, diff --git a/src/main/java/io/supertokens/webserver/api/oauth/OAuthClientListAPI.java b/src/main/java/io/supertokens/webserver/api/oauth/OAuthClientListAPI.java index b728656f9..0d9a2e73c 100644 --- a/src/main/java/io/supertokens/webserver/api/oauth/OAuthClientListAPI.java +++ b/src/main/java/io/supertokens/webserver/api/oauth/OAuthClientListAPI.java @@ -51,7 +51,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IO AppIdentifier appIdentifier = getAppIdentifier(req); Storage storage = enforcePublicTenantAndGetPublicTenantStorage(req); Map queryParams = OAuthProxyHelper.defaultGetQueryParamsFromRequest(req); - queryParams.put("owner", appIdentifier.getAppId()); + queryParams.put("owner", appIdentifier.getConnectionUriDomain() + "_" + appIdentifier.getAppId()); HttpRequestForOAuthProvider.Response response = OAuthProxyHelper.proxyGET( main, req, resp,