From 82c2a202cb10effda4e28af3db1094c8bea2aece Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 3 Apr 2021 14:52:12 +0200 Subject: [PATCH] web/admin/providers/oauth2: only show client secret when clientType is not public Signed-off-by: Jens Langhammer --- web/src/pages/outposts/OutpostForm.ts | 4 ++++ .../pages/providers/oauth2/OAuth2ProviderForm.ts | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/web/src/pages/outposts/OutpostForm.ts b/web/src/pages/outposts/OutpostForm.ts index 3f9de2e2b..fcb71b87c 100644 --- a/web/src/pages/outposts/OutpostForm.ts +++ b/web/src/pages/outposts/OutpostForm.ts @@ -66,6 +66,10 @@ export class OutpostForm extends Form { }); }), html``)} +

${gettext("Selecting a service-connection enables the management of the outpost by authentik.")}

+

+ See documentation. +

{ id: value, }).then(provider => { this.provider = provider; + this.showClientSecret = provider.clientType === OAuth2ProviderClientTypeEnum.Confidential; }); } @property({attribute: false}) provider?: OAuth2Provider; + @property({type: Boolean}) + showClientSecret = true; + getSuccessMessage(): string { if (this.provider) { return gettext("Successfully updated provider."); @@ -79,7 +83,14 @@ export class OAuth2ProviderFormPage extends Form { label=${gettext("Client type")} ?required=${true} name="clientType"> - { + const target = ev.target as HTMLSelectElement; + if (target.selectedOptions[0].value === OAuth2ProviderClientTypeEnum.Public) { + this.showClientSecret = false; + } else { + this.showClientSecret = true; + } + }}> @@ -96,6 +107,7 @@ export class OAuth2ProviderFormPage extends Form {