fix: Properly output saml validation errors (#8284)

This commit is contained in:
Omar Ajoue 2024-01-10 15:56:04 +00:00 committed by GitHub
parent 53612def31
commit 8c7f39907f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,7 +88,13 @@ export async function validateMetadata(metadata: string): Promise<boolean> {
return true;
} else {
logger.warn('SAML Validate Metadata: Invalid metadata');
logger.warn(validationResult ? validationResult.errors.join('\n') : '');
logger.warn(
validationResult
? validationResult.errors
.map((error) => `${error.message} - ${error.rawMessage}`)
.join('\n')
: '',
);
}
} catch (error) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
@ -118,7 +124,13 @@ export async function validateResponse(response: string): Promise<boolean> {
return true;
} else {
logger.warn('SAML Validate Response: Failed');
logger.warn(validationResult ? validationResult.errors.join('\n') : '');
logger.warn(
validationResult
? validationResult.errors
.map((error) => `${error.message} - ${error.rawMessage}`)
.join('\n')
: '',
);
}
} catch (error) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument