mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
LDAP: Render root CA and client cert as text fields (#94382)
render root CA and client cert as text fields
This commit is contained in:
parent
546d1517fa
commit
4bbae5eb0a
@ -369,17 +369,14 @@ export const LdapDrawerComponent = ({
|
||||
<Field
|
||||
label={t('ldap-drawer.extra-security-section.client-cert-value-label', 'Client certificate content')}
|
||||
>
|
||||
<SecretInput
|
||||
<Input
|
||||
id="client-cert"
|
||||
placeholder={t(
|
||||
'ldap-drawer.extra-security-section.client-cert-value-placeholder',
|
||||
'Client certificate content in base64'
|
||||
)}
|
||||
isConfigured={mapCertConfigured.clientCertValue}
|
||||
onReset={() => {
|
||||
setValue(`${serverConfig}.client_cert_value`, '');
|
||||
setMapCertConfigured({ ...mapCertConfigured, clientCertValue: false });
|
||||
}}
|
||||
type="text"
|
||||
{...register(`${serverConfig}.client_cert_value`)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label={t('ldap-drawer.extra-security-section.client-key-value-label', 'Client key content')}>
|
||||
@ -401,35 +398,25 @@ export const LdapDrawerComponent = ({
|
||||
{encryptionProvider === EncryptionProvider.FilePath && (
|
||||
<>
|
||||
<Field label={t('ldap-drawer.extra-security-section.root-ca-cert-label', 'Root CA certificate path')}>
|
||||
<SecretInput
|
||||
<Input
|
||||
id="root-ca-cert"
|
||||
placeholder={t(
|
||||
'ldap-drawer.extra-security-section.root-ca-cert-placeholder',
|
||||
'/path/to/root_ca_cert.pem'
|
||||
)}
|
||||
isConfigured={mapCertConfigured.rootCaCertPath}
|
||||
onReset={() => {
|
||||
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`)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label={t('ldap-drawer.extra-security-section.client-cert-label', 'Client certificate path')}>
|
||||
<SecretInput
|
||||
<Input
|
||||
id="client-cert"
|
||||
placeholder={t(
|
||||
'ldap-drawer.extra-security-section.client-cert-placeholder',
|
||||
'/path/to/client_cert.pem'
|
||||
)}
|
||||
isConfigured={mapCertConfigured.clientCertPath}
|
||||
onReset={() => {
|
||||
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`)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label={t('ldap-drawer.extra-security-section.client-key-label', 'Client key path')}>
|
||||
|
@ -101,13 +101,7 @@ export const LdapSettingsPage = () => {
|
||||
|
||||
const [isBindPasswordConfigured, setBindPasswordConfigured] = useState(false);
|
||||
const [mapKeyCertConfigured, setMapKeyCertConfigured] = useState<MapKeyCertConfigured>({
|
||||
// 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));
|
||||
|
@ -140,10 +140,6 @@ export interface LdapPayload {
|
||||
}
|
||||
|
||||
export interface MapKeyCertConfigured {
|
||||
rootCaCertValue: boolean;
|
||||
clientCertValue: boolean;
|
||||
clientKeyCertValue: boolean;
|
||||
rootCaCertPath: boolean;
|
||||
clientCertPath: boolean;
|
||||
clientKeyCertPath: boolean;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user