From 107b6482b0282379991b0266eb75e2f776a36539 Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Fri, 5 Sep 2025 15:44:36 +0200 Subject: [PATCH 1/6] add auth by app + basic --- python-lib/dss_constants.py | 1 + python-lib/sharepoint_client.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/python-lib/dss_constants.py b/python-lib/dss_constants.py index e13d2a4..fcc4cf2 100644 --- a/python-lib/dss_constants.py +++ b/python-lib/dss_constants.py @@ -11,6 +11,7 @@ class DSSConstants(object): APPLICATION_JSON_NOMETADATA = "application/json;odata=nometadata" AUTH_APP_CERTIFICATE = "app-certificate" AUTH_APP_USERNAME_PASSWORD = "app-username-password" + AUTH_APP_BASIC = "app-basic" AUTH_LOGIN = "login" AUTH_OAUTH = "oauth" AUTH_SITE_APP = "site-app-permissions" diff --git a/python-lib/sharepoint_client.py b/python-lib/sharepoint_client.py index 7c9e5a1..f800075 100644 --- a/python-lib/sharepoint_client.py +++ b/python-lib/sharepoint_client.py @@ -157,6 +157,29 @@ def __init__(self, config): max_retries=SharePointConstants.MAX_RETRIES, base_retry_timer_sec=SharePointConstants.WAIT_TIME_BEFORE_RETRY_SEC ) + elif config.get('auth_type') == DSSConstants.AUTH_APP_BASIC: + logger.info("SharePointClient:app-basic") + login_details = config.get('app_basic') + self.setup_sharepoint_online_url(login_details) + self.setup_login_details(login_details) + self.apply_paths_overwrite(config) + self.tenant_id = login_details.get("tenant_id") + self.client_id = login_details.get("client_id") + self.sharepoint_tenant = login_details.get("sharepoint_tenant") + secure_token = login_details.get("secure_token", {}) + username = secure_token.get("user") + password = secure_token.get("password") + self.sharepoint_access_token = self.get_username_password_access_token(username, password) + self.session.update_settings(session=SharePointSession( + None, + None, + self.sharepoint_url, + self.sharepoint_site, + sharepoint_access_token=self.sharepoint_access_token + ), + max_retries=SharePointConstants.MAX_RETRIES, + base_retry_timer_sec=SharePointConstants.WAIT_TIME_BEFORE_RETRY_SEC + ) else: raise SharePointClientError("The type of authentication is not selected") self.sharepoint_list_title = config.get("sharepoint_list_title") From cd6cd927538e001b8bc21afacdc165f71a28b4e7 Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Fri, 5 Sep 2025 16:07:26 +0200 Subject: [PATCH 2/6] Add new preset to lists --- .../sharepoint-online_lists/connector.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/python-connectors/sharepoint-online_lists/connector.json b/python-connectors/sharepoint-online_lists/connector.json index 4ff862c..99f4797 100644 --- a/python-connectors/sharepoint-online_lists/connector.json +++ b/python-connectors/sharepoint-online_lists/connector.json @@ -32,6 +32,10 @@ { "value": "app-username-password", "label": "User name / password" + }, + { + "value": "app-basic", + "label": "Individual User name / password" } ] }, @@ -70,6 +74,13 @@ "parameterSetId": "app-username-password", "visibilityCondition": "model.auth_type == 'app-username-password'" }, + { + "name": "app_basic", + "label": "App basic", + "type": "PRESET", + "parameterSetId": "app-basic", + "visibilityCondition": "model.auth_type == 'app-basic'" + }, { "name": "sharepoint_list_title", "label": "List title", From 855ef1f06bac8738f3716c27a28f93f5925f46b6 Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Fri, 5 Sep 2025 17:20:57 +0200 Subject: [PATCH 3/6] add new preset to list append recipe --- .../sharepoint-online-append-list/recipe.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/custom-recipes/sharepoint-online-append-list/recipe.json b/custom-recipes/sharepoint-online-append-list/recipe.json index c294d72..71758f7 100644 --- a/custom-recipes/sharepoint-online-append-list/recipe.json +++ b/custom-recipes/sharepoint-online-append-list/recipe.json @@ -52,6 +52,10 @@ { "value": "app-username-password", "label": "User name / password" + }, + { + "value": "app-basic", + "label": "Individual User name / password" } ] }, @@ -90,6 +94,13 @@ "parameterSetId": "app-username-password", "visibilityCondition": "model.auth_type == 'app-username-password'" }, + { + "name": "app_basic", + "label": "App basic", + "type": "PRESET", + "parameterSetId": "app-basic", + "visibilityCondition": "model.auth_type == 'app-basic'" + }, { "name": "sharepoint_list_title", "label": "List title", From 932ae7286ad21c74cadaf10faff197e6b796be49 Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Fri, 5 Sep 2025 17:21:46 +0200 Subject: [PATCH 4/6] add new preset to shared documents --- .../fs-provider.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/python-fs-providers/sharepoint-online_shared-documents/fs-provider.json b/python-fs-providers/sharepoint-online_shared-documents/fs-provider.json index d2f858f..2dab381 100644 --- a/python-fs-providers/sharepoint-online_shared-documents/fs-provider.json +++ b/python-fs-providers/sharepoint-online_shared-documents/fs-provider.json @@ -29,6 +29,10 @@ { "value": "app-username-password", "label": "User name / password" + }, + { + "value": "app-basic", + "label": "Individual User name / password" } ] }, @@ -67,6 +71,13 @@ "parameterSetId": "app-username-password", "visibilityCondition": "model.auth_type == 'app-username-password'" }, + { + "name": "app_basic", + "label": "App basic", + "type": "PRESET", + "parameterSetId": "app-basic", + "visibilityCondition": "model.auth_type == 'app-basic'" + }, { "name": "advanced_parameters", "label": "Show advanced parameters", From e71da9bff73755e26dd79d5a75eeb5137be28393 Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Fri, 5 Sep 2025 17:22:06 +0200 Subject: [PATCH 5/6] add new preset --- parameter-sets/app-basic/parameter-set.json | 55 +++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 parameter-sets/app-basic/parameter-set.json diff --git a/parameter-sets/app-basic/parameter-set.json b/parameter-sets/app-basic/parameter-set.json new file mode 100644 index 0000000..1c7719a --- /dev/null +++ b/parameter-sets/app-basic/parameter-set.json @@ -0,0 +1,55 @@ +{ + "meta": { + "label": "App username password (user)", + "description": "", + "icon": "icon-cloud" + }, + "defaultDefinableInline": false, + "defaultDefinableAtProjectLevel": false, + "pluginParams": [], + "params": [ + { + "name": "sharepoint_tenant", + "label": "Tenant", + "type": "STRING", + "description": "As in .sharepoint.com. Please refer to plugin doc.", + "mandatory": true + }, + { + "name": "sharepoint_site", + "label": "Site path", + "type": "STRING", + "description": "sites/site_name/subsite...", + "mandatory": true + }, + { + "name": "sharepoint_root", + "label": "Root directory", + "type": "STRING", + "description": "", + "defaultValue": "Shared Documents" + }, + { + "name": "tenant_id", + "label": "Tenant ID", + "type": "STRING", + "description": "", + "mandatory": true + }, + { + "name": "client_id", + "label": "Client ID", + "type": "STRING", + "description": "", + "mandatory": true + }, + { + "name": "secure_token", + "type": "CREDENTIAL_REQUEST", + "label": "Azure Single Sign On", + "credentialRequestSettings": { + "type": "BASIC" + } + } + ] +} \ No newline at end of file From 7d91079ccc6c1568ffa4f9a7ec0cd45ac9a8da65 Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Tue, 9 Sep 2025 16:25:06 +0200 Subject: [PATCH 6/6] Add integration test --- tests/python/integration/test_scenario.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/python/integration/test_scenario.py b/tests/python/integration/test_scenario.py index d646dae..162ad0d 100644 --- a/tests/python/integration/test_scenario.py +++ b/tests/python/integration/test_scenario.py @@ -61,3 +61,7 @@ def test_run_sharepoint_online_256_plus_chars_strings(user_dss_clients): def test_run_sharepoint_online_app_username_password_auth(user_dss_clients): dss_scenario.run(user_dss_clients, project_key=TEST_PROJECT_KEY, scenario_id="APPUSERNAMEPASSWORDAUTH") + + +def test_run_sharepoint_online_app_basic_auth(user_dss_clients): + dss_scenario.run(user_dss_clients, project_key=TEST_PROJECT_KEY, scenario_id="APPBASICAUTH")