Skip to content

Commit

Permalink
Only override the authentication type from server when not already se…
Browse files Browse the repository at this point in the history
…t in the component
  • Loading branch information
pavsaund committed Aug 29, 2023
1 parent fcd6c9c commit e0ccd9f
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e0ccd9f

Please sign in to comment.