From 39e0ed29628d95abe0701b200397ff300ddc0637 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 19 Dec 2022 10:54:51 +0100 Subject: [PATCH] web/admin: better show metadata download for saml provider Signed-off-by: Jens Langhammer --- .../providers/saml/SAMLProviderViewPage.ts | 69 +++++++++++++------ 1 file changed, 48 insertions(+), 21 deletions(-) diff --git a/web/src/admin/providers/saml/SAMLProviderViewPage.ts b/web/src/admin/providers/saml/SAMLProviderViewPage.ts index b803f55fe..9bdc451ef 100644 --- a/web/src/admin/providers/saml/SAMLProviderViewPage.ts +++ b/web/src/admin/providers/saml/SAMLProviderViewPage.ts @@ -75,32 +75,59 @@ export class SAMLProviderViewPage extends AKElement { } async renderRelatedObjects(): Promise { - if (!this.provider?.signingKp) { - return Promise.resolve(html``); + const relatedObjects = []; + if (this.provider?.assignedApplicationName) { + relatedObjects.push(html`
+
+ ${t`Metadata`} +
+
+
+ + ${t`Download`} + + { + return navigator.clipboard.writeText( + this.provider?.urlDownloadMetadata || "", + ); + }} + > + ${t`Copy download URL`} + +
+
+
`); + } + if (this.provider?.signingKp) { + const kp = await new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsRetrieve({ + kpUuid: this.provider.signingKp, + }); + relatedObjects.push(html`
+
+ ${t`Download signing certificate`} +
+
+ +
+
`); } - const kp = await new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsRetrieve({ - kpUuid: this.provider.signingKp, - }); return html`
${t`Related objects`}
-
-
- ${t`Download signing certificate`} -
-
- -
-
+ ${relatedObjects.length > 0 ? relatedObjects : html`-`}
`;