From 27d3547cfb96a0246e8ea93ab0c65511a0c253a0 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 22 Mar 2023 23:57:24 +0100 Subject: [PATCH] group flow settings when providers have multiple flows Signed-off-by: Jens Langhammer --- .../providers/oauth2/OAuth2ProviderForm.ts | 80 +++++++++++++++++++ .../admin/providers/saml/SAMLProviderForm.ts | 80 +++++++++++++++++++ web/src/flow/providers/SessionEnd.ts | 2 +- 3 files changed, 161 insertions(+), 1 deletion(-) diff --git a/web/src/admin/providers/oauth2/OAuth2ProviderForm.ts b/web/src/admin/providers/oauth2/OAuth2ProviderForm.ts index 105f05d5f..1b66b07b7 100644 --- a/web/src/admin/providers/oauth2/OAuth2ProviderForm.ts +++ b/web/src/admin/providers/oauth2/OAuth2ProviderForm.ts @@ -282,6 +282,86 @@ export class OAuth2ProviderFormPage extends BaseProviderForm { + + ${t`Flow settings`} +
+ + => { + const args: FlowsInstancesListRequest = { + ordering: "slug", + designation: FlowsInstancesListDesignationEnum.Authorization, + }; + if (query !== undefined) { + args.search = query; + } + const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList( + args, + ); + return flows.results; + }} + .renderElement=${(flow: Flow): string => { + return RenderFlowOption(flow); + }} + .renderDescription=${(flow: Flow): TemplateResult => { + return html`${flow.name}`; + }} + .value=${(flow: Flow | undefined): string | undefined => { + return flow?.pk; + }} + .selected=${(flow: Flow): boolean => { + return flow.pk === this.instance?.authorizationFlow; + }} + > + +

+ ${t`Flow used when authorizing this provider.`} +

+
+ + => { + const args: FlowsInstancesListRequest = { + ordering: "slug", + designation: FlowsInstancesListDesignationEnum.Invalidation, + }; + if (query !== undefined) { + args.search = query; + } + const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList( + args, + ); + return flows.results; + }} + .renderElement=${(flow: Flow): string => { + return RenderFlowOption(flow); + }} + .renderDescription=${(flow: Flow): TemplateResult => { + return html`${flow.name}`; + }} + .value=${(flow: Flow | undefined): string | undefined => { + return flow?.pk; + }} + .selected=${(flow: Flow): boolean => { + return flow.pk === this.instance?.invalidationFlow; + }} + > + +

+ ${t`Flow used when authorizing this provider.`} +

+
+
+
+ ${msg("Advanced protocol settings")}
diff --git a/web/src/admin/providers/saml/SAMLProviderForm.ts b/web/src/admin/providers/saml/SAMLProviderForm.ts index 006a32545..e579ff573 100644 --- a/web/src/admin/providers/saml/SAMLProviderForm.ts +++ b/web/src/admin/providers/saml/SAMLProviderForm.ts @@ -159,6 +159,86 @@ export class SAMLProviderFormPage extends BaseProviderForm {
+ + ${t`Flow settings`} +
+ + => { + const args: FlowsInstancesListRequest = { + ordering: "slug", + designation: FlowsInstancesListDesignationEnum.Authorization, + }; + if (query !== undefined) { + args.search = query; + } + const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList( + args, + ); + return flows.results; + }} + .renderElement=${(flow: Flow): string => { + return RenderFlowOption(flow); + }} + .renderDescription=${(flow: Flow): TemplateResult => { + return html`${flow.name}`; + }} + .value=${(flow: Flow | undefined): string | undefined => { + return flow?.pk; + }} + .selected=${(flow: Flow): boolean => { + return flow.pk === this.instance?.authorizationFlow; + }} + > + +

+ ${t`Flow used when authorizing this provider.`} +

+
+ + => { + const args: FlowsInstancesListRequest = { + ordering: "slug", + designation: FlowsInstancesListDesignationEnum.Invalidation, + }; + if (query !== undefined) { + args.search = query; + } + const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList( + args, + ); + return flows.results; + }} + .renderElement=${(flow: Flow): string => { + return RenderFlowOption(flow); + }} + .renderDescription=${(flow: Flow): TemplateResult => { + return html`${flow.name}`; + }} + .value=${(flow: Flow | undefined): string | undefined => { + return flow?.pk; + }} + .selected=${(flow: Flow): boolean => { + return flow.pk === this.instance?.invalidationFlow; + }} + > + +

+ ${t`Flow used when authorizing this provider.`} +

+
+
+
+ ${msg("Advanced protocol settings")}
diff --git a/web/src/flow/providers/SessionEnd.ts b/web/src/flow/providers/SessionEnd.ts index fee1dcf2f..b1b4493cc 100644 --- a/web/src/flow/providers/SessionEnd.ts +++ b/web/src/flow/providers/SessionEnd.ts @@ -4,7 +4,7 @@ import { BaseStage } from "@goauthentik/flow/stages/base"; import { t } from "@lingui/macro"; import { CSSResult, TemplateResult, html } from "lit"; -import { customElement } from "lit/decorators"; +import { customElement } from "lit/decorators.js"; import PFButton from "@patternfly/patternfly/components/Button/button.css"; import PFForm from "@patternfly/patternfly/components/Form/form.css";