mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
(cherry picked from commit 181d04c2e1
)
Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
This commit is contained in:
parent
bc031b47df
commit
b1ad06ab6b
2 changed files with 23 additions and 2 deletions
|
@ -5,7 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { validateHosts, validateYamlConfig } from './output_form_validators';
|
||||
import {
|
||||
validateHosts,
|
||||
validateYamlConfig,
|
||||
validateCATrustedFingerPrint,
|
||||
} from './output_form_validators';
|
||||
|
||||
describe('Output form validation', () => {
|
||||
describe('validateHosts', () => {
|
||||
|
@ -72,4 +76,21 @@ describe('Output form validation', () => {
|
|||
}
|
||||
});
|
||||
});
|
||||
describe('validate', () => {
|
||||
it('should work with a valid fingerprint', () => {
|
||||
const res = validateCATrustedFingerPrint(
|
||||
'9f0a10411457adde3982ef01df20d2e7aa53a8ef29c50bcbfa3f3e93aebf631b'
|
||||
);
|
||||
|
||||
expect(res).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should return an error with a invalid formatted fingerprint', () => {
|
||||
const res = validateCATrustedFingerPrint(
|
||||
'9F:0A:10:41:14:57:AD:DE:39:82:EF:01:DF:20:D2:E7:AA:53:A8:EF:29:C5:0B:CB:FA:3F:3E:93:AE:BF:63:1B'
|
||||
);
|
||||
|
||||
expect(res).toEqual(['CA trusted fingerprint should be a base64 CA sha256 fingerprint']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -73,7 +73,7 @@ export function validateName(value: string) {
|
|||
}
|
||||
|
||||
export function validateCATrustedFingerPrint(value: string) {
|
||||
if (value !== '' && !value.match(/^[a-zA-Z0-9]$/)) {
|
||||
if (value !== '' && !value.match(/^[a-zA-Z0-9]+$/)) {
|
||||
return [
|
||||
i18n.translate('xpack.fleet.settings.outputForm.caTrusterdFingerprintInvalidErrorMessage', {
|
||||
defaultMessage: 'CA trusted fingerprint should be a base64 CA sha256 fingerprint',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue