From 4bbae5eb0a12b0128f313d2360dbdc121e35a1c7 Mon Sep 17 00:00:00 2001 From: Mihai Doarna Date: Tue, 8 Oct 2024 18:54:34 +0300 Subject: [PATCH] LDAP: Render root CA and client cert as text fields (#94382) render root CA and client cert as text fields --- public/app/features/admin/ldap/LdapDrawer.tsx | 31 ++++++------------- .../features/admin/ldap/LdapSettingsPage.tsx | 10 ------ public/app/types/ldap.ts | 4 --- 3 files changed, 9 insertions(+), 36 deletions(-) diff --git a/public/app/features/admin/ldap/LdapDrawer.tsx b/public/app/features/admin/ldap/LdapDrawer.tsx index dc84858191b..0533fadb634 100644 --- a/public/app/features/admin/ldap/LdapDrawer.tsx +++ b/public/app/features/admin/ldap/LdapDrawer.tsx @@ -369,17 +369,14 @@ export const LdapDrawerComponent = ({ - { - setValue(`${serverConfig}.client_cert_value`, ''); - setMapCertConfigured({ ...mapCertConfigured, clientCertValue: false }); - }} + type="text" + {...register(`${serverConfig}.client_cert_value`)} /> @@ -401,35 +398,25 @@ export const LdapDrawerComponent = ({ {encryptionProvider === EncryptionProvider.FilePath && ( <> - { - setValue(`${serverConfig}.root_ca_cert`, ''); - setMapCertConfigured({ ...mapCertConfigured, rootCaCertPath: false }); - }} - value={watch(`${serverConfig}.root_ca_cert`)} - onChange={({ currentTarget: { value } }) => setValue(`${serverConfig}.root_ca_cert`, value)} + type="text" + {...register(`${serverConfig}.root_ca_cert`)} /> - { - setValue(`${serverConfig}.client_cert`, ''); - setMapCertConfigured({ ...mapCertConfigured, clientCertPath: false }); - }} - value={watch(`${serverConfig}.client_cert`)} - onChange={({ currentTarget: { value } }) => setValue(`${serverConfig}.client_cert`, value)} + type="text" + {...register(`${serverConfig}.client_cert`)} /> diff --git a/public/app/features/admin/ldap/LdapSettingsPage.tsx b/public/app/features/admin/ldap/LdapSettingsPage.tsx index 7621a3fb94a..6c518cb973b 100644 --- a/public/app/features/admin/ldap/LdapSettingsPage.tsx +++ b/public/app/features/admin/ldap/LdapSettingsPage.tsx @@ -101,13 +101,7 @@ export const LdapSettingsPage = () => { const [isBindPasswordConfigured, setBindPasswordConfigured] = useState(false); const [mapKeyCertConfigured, setMapKeyCertConfigured] = useState({ - // values - rootCaCertValue: false, - clientCertValue: false, clientKeyCertValue: false, - // paths - rootCaCertPath: false, - clientCertPath: false, clientKeyCertPath: false, }); @@ -133,11 +127,7 @@ export const LdapSettingsPage = () => { serverConfig = payload.settings.config.servers[0]; } setMapKeyCertConfigured({ - rootCaCertValue: serverConfig.root_ca_cert_value?.length > 0, - clientCertValue: isOptionDefined(serverConfig.client_cert_value), clientKeyCertValue: isOptionDefined(serverConfig.client_key_value), - rootCaCertPath: isOptionDefined(serverConfig.root_ca_cert), - clientCertPath: isOptionDefined(serverConfig.client_cert), clientKeyCertPath: isOptionDefined(serverConfig.client_key), }); setBindPasswordConfigured(isOptionDefined(serverConfig.bind_password)); diff --git a/public/app/types/ldap.ts b/public/app/types/ldap.ts index 5ead539eb08..6f176ee1c89 100644 --- a/public/app/types/ldap.ts +++ b/public/app/types/ldap.ts @@ -140,10 +140,6 @@ export interface LdapPayload { } export interface MapKeyCertConfigured { - rootCaCertValue: boolean; - clientCertValue: boolean; clientKeyCertValue: boolean; - rootCaCertPath: boolean; - clientCertPath: boolean; clientKeyCertPath: boolean; }