From ed23046dedc0b4ca962873450217436643676be3 Mon Sep 17 00:00:00 2001 From: Aman Agarwal Date: Mon, 8 Apr 2024 14:34:53 +0530 Subject: [PATCH] fix: self signed certificates value set in the props (#32474) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Earlier the `useSelfSignedCert` value for the rest api datasource was not being sent from the transformer to the props. After this pr the value is being sent to the props which will persist the changed data instead of overriding it with initialvalues where the `useSelfSignedCert` was not selected. Fixed the `data-location-id` for the form control as well from `selfsignedcert` to `authentication.useSelfSignedCert`, just like the other form control values. Fixes #26598 _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Datasource" ### :mag: Cypress test results > [!IMPORTANT] > Workflow run: > Commit: `1b5a9c8c713b61bd633b377810bc964a3f085ece` > Cypress dashboard url: Click here! > All cypress tests have passed 🎉🎉🎉 ## Summary by CodeRabbit - **Refactor** - Improved the handling of self-signed certificates in REST API datasource configurations. --- .../pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx | 4 +++- .../src/transformers/RestAPIDatasourceFormTransformer.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx b/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx index 1f92ee0153..58246322cb 100644 --- a/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx +++ b/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx @@ -751,7 +751,9 @@ class DatasourceRestAPIEditor extends React.Component { )} {isConnectSelfSigned && ( - + {this.renderCheckboxViaFormControl( "authentication.useSelfSignedCert", "Use Self-Signed Certificate for Authorization requests", diff --git a/app/client/src/transformers/RestAPIDatasourceFormTransformer.ts b/app/client/src/transformers/RestAPIDatasourceFormTransformer.ts index 6149cd1b08..9274983ef0 100644 --- a/app/client/src/transformers/RestAPIDatasourceFormTransformer.ts +++ b/app/client/src/transformers/RestAPIDatasourceFormTransformer.ts @@ -259,6 +259,7 @@ const datasourceToFormAuthentication = ( authentication.sendScopeWithRefreshToken || false, refreshTokenClientCredentialsLocation: authentication.refreshTokenClientCredentialsLocation || "BODY", + useSelfSignedCert: authentication.useSelfSignedCert, }; if (isClientCredentials(authType, authentication)) { return {