From f53d7bd6f50521c83eef18f7077419d66f7254a2 Mon Sep 17 00:00:00 2001 From: Oshanath Rajawasam Date: Mon, 30 Sep 2024 22:57:46 +0530 Subject: [PATCH] Stopped secret placeholder from overriding the client secret and password in endpoint security --- .../components/Apis/Details/Endpoints/EndpointOverview.jsx | 5 +++++ .../Endpoints/GeneralConfiguration/EndpointSecurity.jsx | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/EndpointOverview.jsx b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/EndpointOverview.jsx index 7bf82518905..fc02c40c31e 100644 --- a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/EndpointOverview.jsx +++ b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/EndpointOverview.jsx @@ -710,6 +710,11 @@ function EndpointOverview(props) { const saveEndpointSecurityConfig = (endpointSecurityObj, enType) => { const { type } = endpointSecurityObj; let newEndpointSecurityObj = endpointSecurityObj; + const secretPlaceholder = '******'; + newEndpointSecurityObj.clientSecret = newEndpointSecurityObj.clientSecret + === secretPlaceholder ? '' : newEndpointSecurityObj.clientSecret; + newEndpointSecurityObj.password = newEndpointSecurityObj.password + === secretPlaceholder ? '' : newEndpointSecurityObj.password; if (type === 'NONE') { newEndpointSecurityObj = { ...CONSTS.DEFAULT_ENDPOINT_SECURITY, type }; } else { diff --git a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/GeneralConfiguration/EndpointSecurity.jsx b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/GeneralConfiguration/EndpointSecurity.jsx index 9f6b5acd104..f50ffddd2df 100644 --- a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/GeneralConfiguration/EndpointSecurity.jsx +++ b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Endpoints/GeneralConfiguration/EndpointSecurity.jsx @@ -188,13 +188,14 @@ function EndpointSecurity(props) { const { type, username, password, grantType, tokenUrl, clientId, clientSecret, customParameters, } = securityInfo; + const secretPlaceholder = '******'; tmpSecurity.type = type === null ? 'NONE' : type; tmpSecurity.username = username; - tmpSecurity.password = password === '' ? '**********' : password; + tmpSecurity.password = password === '' ? secretPlaceholder : password; tmpSecurity.grantType = grantType; tmpSecurity.tokenUrl = tokenUrl; - tmpSecurity.clientId = clientId === '' ? '********' : clientId; - tmpSecurity.clientSecret = clientSecret === '' ? '********' : clientSecret; + tmpSecurity.clientId = clientId === '' ? secretPlaceholder : clientId; + tmpSecurity.clientSecret = clientSecret === '' ? secretPlaceholder : clientSecret; tmpSecurity.customParameters = customParameters; } setEndpointSecurityInfo(tmpSecurity);