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",
|
encryptAssertions: "Encrypt assertions",
|
||||||
clientSignature: "Client signature required",
|
clientSignature: "Client signature required",
|
||||||
downloadAdaptorTitle: "Download adaptor configs",
|
downloadAdaptorTitle: "Download adaptor configs",
|
||||||
|
privateKeyMask: "PRIVATE KEY NOT SET UP OR KNOWN",
|
||||||
keys: "Keys",
|
keys: "Keys",
|
||||||
credentials: "Credentials",
|
credentials: "Credentials",
|
||||||
roles: "Roles",
|
roles: "Roles",
|
||||||
|
|
|
@ -51,6 +51,12 @@ export const DownloadDialog = ({
|
||||||
[selected]
|
[selected]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const sanitizeSnippet = (snippet: string) =>
|
||||||
|
snippet.replace(
|
||||||
|
/(?<=<PrivateKeyPem>).*(?=<\/PrivateKeyPem>)/gs,
|
||||||
|
t("clients:privateKeyMask")
|
||||||
|
);
|
||||||
|
|
||||||
useFetch(
|
useFetch(
|
||||||
async () => {
|
async () => {
|
||||||
const snippet = await adminClient.clients.getInstallationProviders({
|
const snippet = await adminClient.clients.getInstallationProviders({
|
||||||
|
@ -58,7 +64,7 @@ export const DownloadDialog = ({
|
||||||
providerId: selected,
|
providerId: selected,
|
||||||
});
|
});
|
||||||
if (typeof snippet === "string") {
|
if (typeof snippet === "string") {
|
||||||
return snippet;
|
return sanitizeSnippet(snippet);
|
||||||
} else {
|
} else {
|
||||||
return prettyPrintJSON(snippet);
|
return prettyPrintJSON(snippet);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue