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
|
<Field
|
||||||
label={t('ldap-drawer.extra-security-section.client-cert-value-label', 'Client certificate content')}
|
label={t('ldap-drawer.extra-security-section.client-cert-value-label', 'Client certificate content')}
|
||||||
>
|
>
|
||||||
<SecretInput
|
<Input
|
||||||
id="client-cert"
|
id="client-cert"
|
||||||
placeholder={t(
|
placeholder={t(
|
||||||
'ldap-drawer.extra-security-section.client-cert-value-placeholder',
|
'ldap-drawer.extra-security-section.client-cert-value-placeholder',
|
||||||
'Client certificate content in base64'
|
'Client certificate content in base64'
|
||||||
)}
|
)}
|
||||||
isConfigured={mapCertConfigured.clientCertValue}
|
type="text"
|
||||||
onReset={() => {
|
{...register(`${serverConfig}.client_cert_value`)}
|
||||||
setValue(`${serverConfig}.client_cert_value`, '');
|
|
||||||
setMapCertConfigured({ ...mapCertConfigured, clientCertValue: false });
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
<Field label={t('ldap-drawer.extra-security-section.client-key-value-label', 'Client key content')}>
|
<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 && (
|
{encryptionProvider === EncryptionProvider.FilePath && (
|
||||||
<>
|
<>
|
||||||
<Field label={t('ldap-drawer.extra-security-section.root-ca-cert-label', 'Root CA certificate path')}>
|
<Field label={t('ldap-drawer.extra-security-section.root-ca-cert-label', 'Root CA certificate path')}>
|
||||||
<SecretInput
|
<Input
|
||||||
id="root-ca-cert"
|
id="root-ca-cert"
|
||||||
placeholder={t(
|
placeholder={t(
|
||||||
'ldap-drawer.extra-security-section.root-ca-cert-placeholder',
|
'ldap-drawer.extra-security-section.root-ca-cert-placeholder',
|
||||||
'/path/to/root_ca_cert.pem'
|
'/path/to/root_ca_cert.pem'
|
||||||
)}
|
)}
|
||||||
isConfigured={mapCertConfigured.rootCaCertPath}
|
type="text"
|
||||||
onReset={() => {
|
{...register(`${serverConfig}.root_ca_cert`)}
|
||||||
setValue(`${serverConfig}.root_ca_cert`, '');
|
|
||||||
setMapCertConfigured({ ...mapCertConfigured, rootCaCertPath: false });
|
|
||||||
}}
|
|
||||||
value={watch(`${serverConfig}.root_ca_cert`)}
|
|
||||||
onChange={({ currentTarget: { value } }) => setValue(`${serverConfig}.root_ca_cert`, value)}
|
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
<Field label={t('ldap-drawer.extra-security-section.client-cert-label', 'Client certificate path')}>
|
<Field label={t('ldap-drawer.extra-security-section.client-cert-label', 'Client certificate path')}>
|
||||||
<SecretInput
|
<Input
|
||||||
id="client-cert"
|
id="client-cert"
|
||||||
placeholder={t(
|
placeholder={t(
|
||||||
'ldap-drawer.extra-security-section.client-cert-placeholder',
|
'ldap-drawer.extra-security-section.client-cert-placeholder',
|
||||||
'/path/to/client_cert.pem'
|
'/path/to/client_cert.pem'
|
||||||
)}
|
)}
|
||||||
isConfigured={mapCertConfigured.clientCertPath}
|
type="text"
|
||||||
onReset={() => {
|
{...register(`${serverConfig}.client_cert`)}
|
||||||
setValue(`${serverConfig}.client_cert`, '');
|
|
||||||
setMapCertConfigured({ ...mapCertConfigured, clientCertPath: false });
|
|
||||||
}}
|
|
||||||
value={watch(`${serverConfig}.client_cert`)}
|
|
||||||
onChange={({ currentTarget: { value } }) => setValue(`${serverConfig}.client_cert`, value)}
|
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
<Field label={t('ldap-drawer.extra-security-section.client-key-label', 'Client key path')}>
|
<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 [isBindPasswordConfigured, setBindPasswordConfigured] = useState(false);
|
||||||
const [mapKeyCertConfigured, setMapKeyCertConfigured] = useState<MapKeyCertConfigured>({
|
const [mapKeyCertConfigured, setMapKeyCertConfigured] = useState<MapKeyCertConfigured>({
|
||||||
// values
|
|
||||||
rootCaCertValue: false,
|
|
||||||
clientCertValue: false,
|
|
||||||
clientKeyCertValue: false,
|
clientKeyCertValue: false,
|
||||||
// paths
|
|
||||||
rootCaCertPath: false,
|
|
||||||
clientCertPath: false,
|
|
||||||
clientKeyCertPath: false,
|
clientKeyCertPath: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -133,11 +127,7 @@ export const LdapSettingsPage = () => {
|
|||||||
serverConfig = payload.settings.config.servers[0];
|
serverConfig = payload.settings.config.servers[0];
|
||||||
}
|
}
|
||||||
setMapKeyCertConfigured({
|
setMapKeyCertConfigured({
|
||||||
rootCaCertValue: serverConfig.root_ca_cert_value?.length > 0,
|
|
||||||
clientCertValue: isOptionDefined(serverConfig.client_cert_value),
|
|
||||||
clientKeyCertValue: isOptionDefined(serverConfig.client_key_value),
|
clientKeyCertValue: isOptionDefined(serverConfig.client_key_value),
|
||||||
rootCaCertPath: isOptionDefined(serverConfig.root_ca_cert),
|
|
||||||
clientCertPath: isOptionDefined(serverConfig.client_cert),
|
|
||||||
clientKeyCertPath: isOptionDefined(serverConfig.client_key),
|
clientKeyCertPath: isOptionDefined(serverConfig.client_key),
|
||||||
});
|
});
|
||||||
setBindPasswordConfigured(isOptionDefined(serverConfig.bind_password));
|
setBindPasswordConfigured(isOptionDefined(serverConfig.bind_password));
|
||||||
|
@ -140,10 +140,6 @@ export interface LdapPayload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface MapKeyCertConfigured {
|
export interface MapKeyCertConfigured {
|
||||||
rootCaCertValue: boolean;
|
|
||||||
clientCertValue: boolean;
|
|
||||||
clientKeyCertValue: boolean;
|
clientKeyCertValue: boolean;
|
||||||
rootCaCertPath: boolean;
|
|
||||||
clientCertPath: boolean;
|
|
||||||
clientKeyCertPath: boolean;
|
clientKeyCertPath: boolean;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user