providers: Add ability to choose a default authentication flow (#5070)
* core: add ability to choose a default authentication flow for a provider Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> * update web to use correct ak-search-select I don't think this element existed when the PR was initially created, lol Signed-off-by: Jens Langhammer <jens@goauthentik.io> * only use provider authentication flow for authentication designation Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add tests Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix tests Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		| @ -314,6 +314,41 @@ export class ProxyProviderFormPage extends ModelForm<ProxyProvider, number> { | ||||
|                     required | ||||
|                 /> | ||||
|             </ak-form-element-horizontal> | ||||
|             <ak-form-element-horizontal | ||||
|                 label=${t`Authentication flow`} | ||||
|                 ?required=${false} | ||||
|                 name="authenticationFlow" | ||||
|             > | ||||
|                 <ak-search-select | ||||
|                     .fetchObjects=${async (query?: string): Promise<Flow[]> => { | ||||
|                         const args: FlowsInstancesListRequest = { | ||||
|                             ordering: "slug", | ||||
|                             designation: FlowsInstancesListDesignationEnum.Authentication, | ||||
|                         }; | ||||
|                         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?.authenticationFlow; | ||||
|                     }} | ||||
|                 > | ||||
|                 </ak-search-select> | ||||
|                 <p class="pf-c-form__helper-text"> | ||||
|                     ${t`Flow used when a user access this provider and is not authenticated.`} | ||||
|                 </p> | ||||
|             </ak-form-element-horizontal> | ||||
|             <ak-form-element-horizontal | ||||
|                 label=${t`Authorization flow`} | ||||
|                 ?required=${true} | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 risson
					risson