Mask private key when exporting SAML client (#1326)
This commit is contained in:
parent
d22095fc03
commit
01e6bfeef5
2 changed files with 8 additions and 1 deletions
|
@ -17,6 +17,7 @@ export default {
|
|||
encryptAssertions: "Encrypt assertions",
|
||||
clientSignature: "Client signature required",
|
||||
downloadAdaptorTitle: "Download adaptor configs",
|
||||
privateKeyMask: "PRIVATE KEY NOT SET UP OR KNOWN",
|
||||
keys: "Keys",
|
||||
credentials: "Credentials",
|
||||
roles: "Roles",
|
||||
|
|
|
@ -51,6 +51,12 @@ export const DownloadDialog = ({
|
|||
[selected]
|
||||
);
|
||||
|
||||
const sanitizeSnippet = (snippet: string) =>
|
||||
snippet.replace(
|
||||
/(?<=<PrivateKeyPem>).*(?=<\/PrivateKeyPem>)/gs,
|
||||
t("clients:privateKeyMask")
|
||||
);
|
||||
|
||||
useFetch(
|
||||
async () => {
|
||||
const snippet = await adminClient.clients.getInstallationProviders({
|
||||
|
@ -58,7 +64,7 @@ export const DownloadDialog = ({
|
|||
providerId: selected,
|
||||
});
|
||||
if (typeof snippet === "string") {
|
||||
return snippet;
|
||||
return sanitizeSnippet(snippet);
|
||||
} else {
|
||||
return prettyPrintJSON(snippet);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue