From 21213172a945960ce762db08f35bf2d09f245021 Mon Sep 17 00:00:00 2001 From: Savindu Dimal Date: Mon, 9 Oct 2023 15:38:36 +0530 Subject: [PATCH] Fix transport level security ui Uncheck and disable http checkbox when mtls is checked --- .../APISecurity/components/TransportLevel.jsx | 20 ++++++++++++++----- .../Configuration/components/Transports.jsx | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/components/APISecurity/components/TransportLevel.jsx b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/components/APISecurity/components/TransportLevel.jsx index aa79fac586b..c70de4eccba 100644 --- a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/components/APISecurity/components/TransportLevel.jsx +++ b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/components/APISecurity/components/TransportLevel.jsx @@ -149,6 +149,20 @@ function TransportLevel(props) { }); }; + const handleMutualSSLChange = (event) => { + const { checked } = event.target; + if (checked) { + configDispatcher({ + action: 'transport', + event: { checked: false, value: 'http' }, + }); + } + configDispatcher({ + action: 'securityScheme', + event: { checked, value: API_SECURITY_MUTUAL_SSL }, + }); + }; + // Get the client certificates from backend. useEffect(() => { API.getAllClientCertificates(id).then((resp) => { @@ -192,11 +206,7 @@ function TransportLevel(props) { configDispatcher({ - action: 'securityScheme', - event: { checked, value }, - })} - value={API_SECURITY_MUTUAL_SSL} + onChange={handleMutualSSLChange} color='primary' id='mutual-ssl-checkbox' /> diff --git a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/components/Transports.jsx b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/components/Transports.jsx index b7276148cb9..3dcf00421e1 100644 --- a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/components/Transports.jsx +++ b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Configuration/components/Transports.jsx @@ -84,9 +84,9 @@ export default function Transports(props) { configDispatcher({ action: 'transport', event: { checked, value: 'http' },