From e0ccd9f65baeed8343c3bde48058ad335db30b54 Mon Sep 17 00:00:00 2001 From: Pavneet Singh Saund Date: Tue, 29 Aug 2023 10:41:10 +0200 Subject: [PATCH] Only override the authentication type from server when not already set in the component --- .../connectionDetails/configuration/index.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/index.tsx b/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/index.tsx index ef5033dc4..ca6650599 100644 --- a/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/index.tsx +++ b/Source/SelfService/Web/integrations/connection/connectionDetails/configuration/index.tsx @@ -72,19 +72,22 @@ export const ConfigurationView = () => { if (!connection || !connection.chosenEnvironment.value) { return; } - let authenticationType: M3AuthenticationType | undefined; + let authenticationFromServer: M3AuthenticationType | undefined; if (connection.chosenEnvironment.value.toLowerCase() === 'cloud') { - authenticationType = 'ion'; + authenticationFromServer = 'ion'; } if (connection.chosenEnvironment.value.toLowerCase() === 'on premises') { - if(connection._configuration.m3BasicAuth?.host) { - authenticationType = 'basic'; + if (connection._configuration.m3BasicAuth?.host) { + authenticationFromServer = 'basic'; } - if(connection._configuration.ion?.gatewayUrl) { - authenticationType = 'ion'; + if (connection._configuration.ion?.gatewayUrl) { + authenticationFromServer = 'ion'; } } - setAuthenticationType(authenticationType); + const shouldOverrideAuthenticationFromServer = authenticationFromServer && !authenticationType; + if (shouldOverrideAuthenticationFromServer) { + setAuthenticationType(authenticationFromServer); + } }, [ connection?._configuration.ion, connection?._configuration.mdp,