web/admin: finish migration to search-select
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
68b58fb73c
commit
c46b2d5573
|
@ -62,8 +62,8 @@ export class TypeOAuthCodeApplicationWizardPage extends WizardFormPage {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { docLink } from "@goauthentik/common/global";
|
import { docLink } from "@goauthentik/common/global";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/CodeMirror";
|
import "@goauthentik/elements/CodeMirror";
|
||||||
|
import "@goauthentik/elements/SearchSelect";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||||
|
@ -12,12 +13,11 @@ import { t } from "@lingui/macro";
|
||||||
import { CSSResult, TemplateResult, css, html } from "lit";
|
import { CSSResult, TemplateResult, css, html } from "lit";
|
||||||
import { customElement, state } from "lit/decorators.js";
|
import { customElement, state } from "lit/decorators.js";
|
||||||
import { ifDefined } from "lit/directives/if-defined.js";
|
import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { until } from "lit/directives/until.js";
|
|
||||||
|
|
||||||
import PFContent from "@patternfly/patternfly/components/Content/content.css";
|
import PFContent from "@patternfly/patternfly/components/Content/content.css";
|
||||||
import PFToggleGroup from "@patternfly/patternfly/components/ToggleGroup/toggle-group.css";
|
import PFToggleGroup from "@patternfly/patternfly/components/ToggleGroup/toggle-group.css";
|
||||||
|
|
||||||
import { BlueprintInstance, ManagedApi } from "@goauthentik/api";
|
import { BlueprintFile, BlueprintInstance, ManagedApi } from "@goauthentik/api";
|
||||||
|
|
||||||
enum blueprintSource {
|
enum blueprintSource {
|
||||||
local,
|
local,
|
||||||
|
@ -133,30 +133,36 @@ export class BlueprintForm extends ModelForm<BlueprintInstance, string> {
|
||||||
<div class="pf-c-card__footer">
|
<div class="pf-c-card__footer">
|
||||||
${this.source === blueprintSource.local
|
${this.source === blueprintSource.local
|
||||||
? html`<ak-form-element-horizontal label=${t`Path`} name="path">
|
? html`<ak-form-element-horizontal label=${t`Path`} name="path">
|
||||||
<select class="pf-c-form-control">
|
<ak-search-select
|
||||||
${until(
|
.fetchObjects=${async (
|
||||||
new ManagedApi(DEFAULT_CONFIG)
|
query?: string,
|
||||||
.managedBlueprintsAvailableList()
|
): Promise<BlueprintFile[]> => {
|
||||||
.then((files) => {
|
const items = await new ManagedApi(
|
||||||
return files.map((file) => {
|
DEFAULT_CONFIG,
|
||||||
let name = file.path;
|
).managedBlueprintsAvailableList();
|
||||||
if (file.meta && file.meta.name) {
|
return items.filter((item) =>
|
||||||
name = `${name} (${file.meta.name})`;
|
query ? item.path.includes(query) : true,
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
.renderElement=${(item: BlueprintFile): string => {
|
||||||
|
const name = item.path;
|
||||||
|
if (item.meta && item.meta.name) {
|
||||||
|
return `${name} (${item.meta.name})`;
|
||||||
}
|
}
|
||||||
const selected =
|
return name;
|
||||||
file.path === this.instance?.path;
|
}}
|
||||||
return html`<option
|
.value=${(
|
||||||
?selected=${selected}
|
item: BlueprintFile | undefined,
|
||||||
value=${file.path}
|
): string | undefined => {
|
||||||
|
return item?.path;
|
||||||
|
}}
|
||||||
|
.selected=${(item: BlueprintFile): boolean => {
|
||||||
|
return this.instance?.path === item.path;
|
||||||
|
}}
|
||||||
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${name}
|
</ak-search-select>
|
||||||
</option>`;
|
</ak-form-element-horizontal>`
|
||||||
});
|
|
||||||
}),
|
|
||||||
html`<option>${t`Loading...`}</option>`,
|
|
||||||
)}
|
|
||||||
</select></ak-form-element-horizontal
|
|
||||||
>`
|
|
||||||
: html``}
|
: html``}
|
||||||
${this.source === blueprintSource.oci
|
${this.source === blueprintSource.oci
|
||||||
? html`<ak-form-element-horizontal label=${t`URL`} name="path">
|
? html`<ak-form-element-horizontal label=${t`URL`} name="path">
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
|
import "@goauthentik/elements/SearchSelect";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||||
|
@ -11,7 +12,7 @@ import { customElement } from "lit/decorators.js";
|
||||||
import { ifDefined } from "lit/directives/if-defined.js";
|
import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { until } from "lit/directives/until.js";
|
import { until } from "lit/directives/until.js";
|
||||||
|
|
||||||
import { AdminApi, EventMatcherPolicy, EventsApi, PoliciesApi } from "@goauthentik/api";
|
import { AdminApi, EventMatcherPolicy, EventsApi, PoliciesApi, TypeCreate } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-policy-event-matcher-form")
|
@customElement("ak-policy-event-matcher-form")
|
||||||
export class EventMatcherPolicyForm extends ModelForm<EventMatcherPolicy, string> {
|
export class EventMatcherPolicyForm extends ModelForm<EventMatcherPolicy, string> {
|
||||||
|
@ -72,27 +73,27 @@ export class EventMatcherPolicyForm extends ModelForm<EventMatcherPolicy, string
|
||||||
<span slot="header"> ${t`Policy-specific settings`} </span>
|
<span slot="header"> ${t`Policy-specific settings`} </span>
|
||||||
<div slot="body" class="pf-c-form">
|
<div slot="body" class="pf-c-form">
|
||||||
<ak-form-element-horizontal label=${t`Action`} name="action">
|
<ak-form-element-horizontal label=${t`Action`} name="action">
|
||||||
<select class="pf-c-form-control">
|
<ak-search-select
|
||||||
<option value="" ?selected=${this.instance?.action === undefined}>
|
.fetchObjects=${async (query?: string): Promise<TypeCreate[]> => {
|
||||||
---------
|
const items = await new EventsApi(
|
||||||
</option>
|
DEFAULT_CONFIG,
|
||||||
${until(
|
).eventsEventsActionsList();
|
||||||
new EventsApi(DEFAULT_CONFIG)
|
return items.filter((item) =>
|
||||||
.eventsEventsActionsList()
|
query ? item.name.includes(query) : true,
|
||||||
.then((actions) => {
|
);
|
||||||
return actions.map((action) => {
|
}}
|
||||||
return html`<option
|
.renderElement=${(item: TypeCreate): string => {
|
||||||
value=${action.component}
|
return item.name;
|
||||||
?selected=${this.instance?.action ===
|
}}
|
||||||
action.component}
|
.value=${(item: TypeCreate | undefined): string | undefined => {
|
||||||
|
return item?.component;
|
||||||
|
}}
|
||||||
|
.selected=${(item: TypeCreate): boolean => {
|
||||||
|
return this.instance?.action === item.component;
|
||||||
|
}}
|
||||||
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${action.name}
|
</ak-search-select>
|
||||||
</option>`;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
html`<option>${t`Loading...`}</option>`,
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
<p class="pf-c-form__helper-text">
|
<p class="pf-c-form__helper-text">
|
||||||
${t`Match created events with this action type. When left empty, all action types will be matched.`}
|
${t`Match created events with this action type. When left empty, all action types will be matched.`}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -18,8 +18,10 @@ import {
|
||||||
CoreGroupsListRequest,
|
CoreGroupsListRequest,
|
||||||
CryptoApi,
|
CryptoApi,
|
||||||
CryptoCertificatekeypairsListRequest,
|
CryptoCertificatekeypairsListRequest,
|
||||||
|
Flow,
|
||||||
FlowsApi,
|
FlowsApi,
|
||||||
FlowsInstancesListDesignationEnum,
|
FlowsInstancesListDesignationEnum,
|
||||||
|
FlowsInstancesListRequest,
|
||||||
Group,
|
Group,
|
||||||
LDAPAPIAccessMode,
|
LDAPAPIAccessMode,
|
||||||
LDAPProvider,
|
LDAPProvider,
|
||||||
|
@ -71,32 +73,47 @@ export class LDAPProviderFormPage extends ModelForm<LDAPProvider, number> {
|
||||||
?required=${true}
|
?required=${true}
|
||||||
name="authorizationFlow"
|
name="authorizationFlow"
|
||||||
>
|
>
|
||||||
<select class="pf-c-form-control">
|
|
||||||
${until(
|
${until(
|
||||||
tenant().then((t) => {
|
tenant().then((t) => {
|
||||||
return new FlowsApi(DEFAULT_CONFIG)
|
return html`
|
||||||
.flowsInstancesList({
|
<ak-search-select
|
||||||
|
.fetchObjects=${async (query?: string): Promise<Flow[]> => {
|
||||||
|
const args: FlowsInstancesListRequest = {
|
||||||
ordering: "slug",
|
ordering: "slug",
|
||||||
designation: FlowsInstancesListDesignationEnum.Authentication,
|
designation:
|
||||||
})
|
FlowsInstancesListDesignationEnum.Authentication,
|
||||||
.then((flows) => {
|
};
|
||||||
return flows.results.map((flow) => {
|
if (query !== undefined) {
|
||||||
|
args.search = query;
|
||||||
|
}
|
||||||
|
const flows = await new FlowsApi(
|
||||||
|
DEFAULT_CONFIG,
|
||||||
|
).flowsInstancesList(args);
|
||||||
|
return flows.results;
|
||||||
|
}}
|
||||||
|
.renderElement=${(flow: Flow): string => {
|
||||||
|
return flow.name;
|
||||||
|
}}
|
||||||
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
|
return html`${flow.slug}`;
|
||||||
|
}}
|
||||||
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
|
return flow?.pk;
|
||||||
|
}}
|
||||||
|
.selected=${(flow: Flow): boolean => {
|
||||||
let selected = flow.pk === t.flowAuthentication;
|
let selected = flow.pk === t.flowAuthentication;
|
||||||
if (this.instance?.authorizationFlow === flow.pk) {
|
if (this.instance?.authorizationFlow === flow.pk) {
|
||||||
selected = true;
|
selected = true;
|
||||||
}
|
}
|
||||||
return html`<option
|
return selected;
|
||||||
value=${ifDefined(flow.pk)}
|
}}
|
||||||
?selected=${selected}
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${flow.name} (${flow.slug})
|
</ak-search-select>
|
||||||
</option>`;
|
`;
|
||||||
});
|
|
||||||
});
|
|
||||||
}),
|
}),
|
||||||
html`<option>${t`Loading...`}</option>`,
|
html`<option>${t`Loading...`}</option>`,
|
||||||
)}
|
)}
|
||||||
</select>
|
|
||||||
<p class="pf-c-form__helper-text">
|
<p class="pf-c-form__helper-text">
|
||||||
${t`Flow used for users to authenticate. Currently only identification and password stages are supported.`}
|
${t`Flow used for users to authenticate. Currently only identification and password stages are supported.`}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -97,8 +97,8 @@ export class OAuth2ProviderFormPage extends ModelForm<OAuth2Provider, number> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
|
@ -313,8 +313,8 @@ export class ProxyProviderFormPage extends ModelForm<ProxyProvider, number> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
|
@ -22,7 +22,9 @@ import {
|
||||||
FlowsInstancesListDesignationEnum,
|
FlowsInstancesListDesignationEnum,
|
||||||
FlowsInstancesListRequest,
|
FlowsInstancesListRequest,
|
||||||
PropertymappingsApi,
|
PropertymappingsApi,
|
||||||
|
PropertymappingsSamlListRequest,
|
||||||
ProvidersApi,
|
ProvidersApi,
|
||||||
|
SAMLPropertyMapping,
|
||||||
SAMLProvider,
|
SAMLProvider,
|
||||||
SignatureAlgorithmEnum,
|
SignatureAlgorithmEnum,
|
||||||
SpBindingEnum,
|
SpBindingEnum,
|
||||||
|
@ -87,8 +89,8 @@ export class SAMLProviderFormPage extends ModelForm<SAMLProvider, number> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
@ -276,32 +278,35 @@ export class SAMLProviderFormPage extends ModelForm<SAMLProvider, number> {
|
||||||
label=${t`NameID Property Mapping`}
|
label=${t`NameID Property Mapping`}
|
||||||
name="nameIdMapping"
|
name="nameIdMapping"
|
||||||
>
|
>
|
||||||
<select class="pf-c-form-control">
|
<ak-search-select
|
||||||
<option
|
.fetchObjects=${async (
|
||||||
value=""
|
query?: string,
|
||||||
?selected=${this.instance?.nameIdMapping === undefined}
|
): Promise<SAMLPropertyMapping[]> => {
|
||||||
>
|
const args: PropertymappingsSamlListRequest = {
|
||||||
---------
|
|
||||||
</option>
|
|
||||||
${until(
|
|
||||||
new PropertymappingsApi(DEFAULT_CONFIG)
|
|
||||||
.propertymappingsSamlList({
|
|
||||||
ordering: "saml_name",
|
ordering: "saml_name",
|
||||||
})
|
};
|
||||||
.then((mappings) => {
|
if (query !== undefined) {
|
||||||
return mappings.results.map((mapping) => {
|
args.search = query;
|
||||||
return html`<option
|
}
|
||||||
value=${ifDefined(mapping.pk)}
|
const items = await new PropertymappingsApi(
|
||||||
?selected=${this.instance?.nameIdMapping ===
|
DEFAULT_CONFIG,
|
||||||
mapping.pk}
|
).propertymappingsSamlList(args);
|
||||||
|
return items.results;
|
||||||
|
}}
|
||||||
|
.renderElement=${(item: SAMLPropertyMapping): string => {
|
||||||
|
return item.name;
|
||||||
|
}}
|
||||||
|
.value=${(
|
||||||
|
item: SAMLPropertyMapping | undefined,
|
||||||
|
): string | undefined => {
|
||||||
|
return item?.pk;
|
||||||
|
}}
|
||||||
|
.selected=${(item: SAMLPropertyMapping): boolean => {
|
||||||
|
return this.instance?.nameIdMapping === item.pk;
|
||||||
|
}}
|
||||||
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${mapping.name}
|
</ak-search-select>
|
||||||
</option>`;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
html`<option>${t`Loading...`}</option>`,
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
<p class="pf-c-form__helper-text">
|
<p class="pf-c-form__helper-text">
|
||||||
${t`Configure how the NameID value will be created. When left empty, the NameIDPolicy of the incoming request will be respected.`}
|
${t`Configure how the NameID value will be created. When left empty, the NameIDPolicy of the incoming request will be respected.`}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -62,8 +62,8 @@ export class SAMLProviderImportForm extends Form<SAMLProvider> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils"
|
||||||
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first } from "@goauthentik/common/utils";
|
||||||
import "@goauthentik/elements/CodeMirror";
|
import "@goauthentik/elements/CodeMirror";
|
||||||
|
import "@goauthentik/elements/SearchSelect";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||||
|
@ -15,8 +16,10 @@ import { until } from "lit/directives/until.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CapabilitiesEnum,
|
CapabilitiesEnum,
|
||||||
|
Flow,
|
||||||
FlowsApi,
|
FlowsApi,
|
||||||
FlowsInstancesListDesignationEnum,
|
FlowsInstancesListDesignationEnum,
|
||||||
|
FlowsInstancesListRequest,
|
||||||
OAuthSource,
|
OAuthSource,
|
||||||
OAuthSourceRequest,
|
OAuthSourceRequest,
|
||||||
ProviderTypeEnum,
|
ProviderTypeEnum,
|
||||||
|
@ -399,24 +402,31 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||||
?required=${true}
|
?required=${true}
|
||||||
name="authenticationFlow"
|
name="authenticationFlow"
|
||||||
>
|
>
|
||||||
<select class="pf-c-form-control">
|
<ak-search-select
|
||||||
<option
|
.fetchObjects=${async (query?: string): Promise<Flow[]> => {
|
||||||
value=""
|
const args: FlowsInstancesListRequest = {
|
||||||
?selected=${this.instance?.authenticationFlow === undefined}
|
|
||||||
>
|
|
||||||
---------
|
|
||||||
</option>
|
|
||||||
${until(
|
|
||||||
new FlowsApi(DEFAULT_CONFIG)
|
|
||||||
.flowsInstancesList({
|
|
||||||
ordering: "slug",
|
ordering: "slug",
|
||||||
designation:
|
designation: FlowsInstancesListDesignationEnum.Authentication,
|
||||||
FlowsInstancesListDesignationEnum.Authentication,
|
};
|
||||||
})
|
if (query !== undefined) {
|
||||||
.then((flows) => {
|
args.search = query;
|
||||||
return flows.results.map((flow) => {
|
}
|
||||||
let selected =
|
const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList(
|
||||||
this.instance?.authenticationFlow === flow.pk;
|
args,
|
||||||
|
);
|
||||||
|
return flows.results;
|
||||||
|
}}
|
||||||
|
.renderElement=${(flow: Flow): string => {
|
||||||
|
return flow.name;
|
||||||
|
}}
|
||||||
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
|
return html`${flow.slug}`;
|
||||||
|
}}
|
||||||
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
|
return flow?.pk;
|
||||||
|
}}
|
||||||
|
.selected=${(flow: Flow): boolean => {
|
||||||
|
let selected = this.instance?.authenticationFlow === flow.pk;
|
||||||
if (
|
if (
|
||||||
!this.instance?.pk &&
|
!this.instance?.pk &&
|
||||||
!this.instance?.authenticationFlow &&
|
!this.instance?.authenticationFlow &&
|
||||||
|
@ -424,17 +434,11 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||||
) {
|
) {
|
||||||
selected = true;
|
selected = true;
|
||||||
}
|
}
|
||||||
return html`<option
|
return selected;
|
||||||
value=${ifDefined(flow.pk)}
|
}}
|
||||||
?selected=${selected}
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${flow.name} (${flow.slug})
|
</ak-search-select>
|
||||||
</option>`;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
html`<option>${t`Loading...`}</option>`,
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
<p class="pf-c-form__helper-text">
|
<p class="pf-c-form__helper-text">
|
||||||
${t`Flow to use when authenticating existing users.`}
|
${t`Flow to use when authenticating existing users.`}
|
||||||
</p>
|
</p>
|
||||||
|
@ -444,23 +448,31 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||||
?required=${true}
|
?required=${true}
|
||||||
name="enrollmentFlow"
|
name="enrollmentFlow"
|
||||||
>
|
>
|
||||||
<select class="pf-c-form-control">
|
<ak-search-select
|
||||||
<option
|
.fetchObjects=${async (query?: string): Promise<Flow[]> => {
|
||||||
value=""
|
const args: FlowsInstancesListRequest = {
|
||||||
?selected=${this.instance?.enrollmentFlow === undefined}
|
|
||||||
>
|
|
||||||
---------
|
|
||||||
</option>
|
|
||||||
${until(
|
|
||||||
new FlowsApi(DEFAULT_CONFIG)
|
|
||||||
.flowsInstancesList({
|
|
||||||
ordering: "slug",
|
ordering: "slug",
|
||||||
designation: FlowsInstancesListDesignationEnum.Enrollment,
|
designation: FlowsInstancesListDesignationEnum.Enrollment,
|
||||||
})
|
};
|
||||||
.then((flows) => {
|
if (query !== undefined) {
|
||||||
return flows.results.map((flow) => {
|
args.search = query;
|
||||||
let selected =
|
}
|
||||||
this.instance?.enrollmentFlow === flow.pk;
|
const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList(
|
||||||
|
args,
|
||||||
|
);
|
||||||
|
return flows.results;
|
||||||
|
}}
|
||||||
|
.renderElement=${(flow: Flow): string => {
|
||||||
|
return flow.name;
|
||||||
|
}}
|
||||||
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
|
return html`${flow.slug}`;
|
||||||
|
}}
|
||||||
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
|
return flow?.pk;
|
||||||
|
}}
|
||||||
|
.selected=${(flow: Flow): boolean => {
|
||||||
|
let selected = this.instance?.enrollmentFlow === flow.pk;
|
||||||
if (
|
if (
|
||||||
!this.instance?.pk &&
|
!this.instance?.pk &&
|
||||||
!this.instance?.enrollmentFlow &&
|
!this.instance?.enrollmentFlow &&
|
||||||
|
@ -468,17 +480,11 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
|
||||||
) {
|
) {
|
||||||
selected = true;
|
selected = true;
|
||||||
}
|
}
|
||||||
return html`<option
|
return selected;
|
||||||
value=${ifDefined(flow.pk)}
|
}}
|
||||||
?selected=${selected}
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${flow.name} (${flow.slug})
|
</ak-search-select>
|
||||||
</option>`;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
html`<option>${t`Loading...`}</option>`,
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
<p class="pf-c-form__helper-text">
|
<p class="pf-c-form__helper-text">
|
||||||
${t`Flow to use when enrolling new users.`}
|
${t`Flow to use when enrolling new users.`}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils"
|
||||||
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config";
|
||||||
import { PlexAPIClient, PlexResource, popupCenterScreen } from "@goauthentik/common/helpers/plex";
|
import { PlexAPIClient, PlexResource, popupCenterScreen } from "@goauthentik/common/helpers/plex";
|
||||||
import { first, randomString } from "@goauthentik/common/utils";
|
import { first, randomString } from "@goauthentik/common/utils";
|
||||||
|
import "@goauthentik/elements/SearchSelect";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||||
|
@ -15,8 +16,10 @@ import { until } from "lit/directives/until.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CapabilitiesEnum,
|
CapabilitiesEnum,
|
||||||
|
Flow,
|
||||||
FlowsApi,
|
FlowsApi,
|
||||||
FlowsInstancesListDesignationEnum,
|
FlowsInstancesListDesignationEnum,
|
||||||
|
FlowsInstancesListRequest,
|
||||||
PlexSource,
|
PlexSource,
|
||||||
SourcesApi,
|
SourcesApi,
|
||||||
UserMatchingModeEnum,
|
UserMatchingModeEnum,
|
||||||
|
@ -328,42 +331,43 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||||
?required=${true}
|
?required=${true}
|
||||||
name="authenticationFlow"
|
name="authenticationFlow"
|
||||||
>
|
>
|
||||||
<select class="pf-c-form-control">
|
<ak-search-select
|
||||||
<option
|
.fetchObjects=${async (query?: string): Promise<Flow[]> => {
|
||||||
value=""
|
const args: FlowsInstancesListRequest = {
|
||||||
?selected=${this.instance?.authenticationFlow === undefined}
|
|
||||||
>
|
|
||||||
---------
|
|
||||||
</option>
|
|
||||||
${until(
|
|
||||||
new FlowsApi(DEFAULT_CONFIG)
|
|
||||||
.flowsInstancesList({
|
|
||||||
ordering: "slug",
|
ordering: "slug",
|
||||||
designation:
|
designation: FlowsInstancesListDesignationEnum.Authentication,
|
||||||
FlowsInstancesListDesignationEnum.Authentication,
|
};
|
||||||
})
|
if (query !== undefined) {
|
||||||
.then((flows) => {
|
args.search = query;
|
||||||
return flows.results.map((flow) => {
|
}
|
||||||
let selected =
|
const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList(
|
||||||
this.instance?.authenticationFlow === flow.pk;
|
args,
|
||||||
|
);
|
||||||
|
return flows.results;
|
||||||
|
}}
|
||||||
|
.renderElement=${(flow: Flow): string => {
|
||||||
|
return flow.name;
|
||||||
|
}}
|
||||||
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
|
return html`${flow.slug}`;
|
||||||
|
}}
|
||||||
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
|
return flow?.pk;
|
||||||
|
}}
|
||||||
|
.selected=${(flow: Flow): boolean => {
|
||||||
|
let selected = this.instance?.enrollmentFlow === flow.pk;
|
||||||
if (
|
if (
|
||||||
!this.instance?.pk &&
|
!this.instance?.pk &&
|
||||||
!this.instance?.authenticationFlow &&
|
!this.instance?.enrollmentFlow &&
|
||||||
flow.slug === "default-source-authentication"
|
flow.slug === "default-source-authentication"
|
||||||
) {
|
) {
|
||||||
selected = true;
|
selected = true;
|
||||||
}
|
}
|
||||||
return html`<option
|
return selected;
|
||||||
value=${ifDefined(flow.pk)}
|
}}
|
||||||
?selected=${selected}
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${flow.name} (${flow.slug})
|
</ak-search-select>
|
||||||
</option>`;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
html`<option>${t`Loading...`}</option>`,
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
<p class="pf-c-form__helper-text">
|
<p class="pf-c-form__helper-text">
|
||||||
${t`Flow to use when authenticating existing users.`}
|
${t`Flow to use when authenticating existing users.`}
|
||||||
</p>
|
</p>
|
||||||
|
@ -373,23 +377,31 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||||
?required=${true}
|
?required=${true}
|
||||||
name="enrollmentFlow"
|
name="enrollmentFlow"
|
||||||
>
|
>
|
||||||
<select class="pf-c-form-control">
|
<ak-search-select
|
||||||
<option
|
.fetchObjects=${async (query?: string): Promise<Flow[]> => {
|
||||||
value=""
|
const args: FlowsInstancesListRequest = {
|
||||||
?selected=${this.instance?.enrollmentFlow === undefined}
|
|
||||||
>
|
|
||||||
---------
|
|
||||||
</option>
|
|
||||||
${until(
|
|
||||||
new FlowsApi(DEFAULT_CONFIG)
|
|
||||||
.flowsInstancesList({
|
|
||||||
ordering: "slug",
|
ordering: "slug",
|
||||||
designation: FlowsInstancesListDesignationEnum.Enrollment,
|
designation: FlowsInstancesListDesignationEnum.Enrollment,
|
||||||
})
|
};
|
||||||
.then((flows) => {
|
if (query !== undefined) {
|
||||||
return flows.results.map((flow) => {
|
args.search = query;
|
||||||
let selected =
|
}
|
||||||
this.instance?.enrollmentFlow === flow.pk;
|
const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList(
|
||||||
|
args,
|
||||||
|
);
|
||||||
|
return flows.results;
|
||||||
|
}}
|
||||||
|
.renderElement=${(flow: Flow): string => {
|
||||||
|
return flow.name;
|
||||||
|
}}
|
||||||
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
|
return html`${flow.slug}`;
|
||||||
|
}}
|
||||||
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
|
return flow?.pk;
|
||||||
|
}}
|
||||||
|
.selected=${(flow: Flow): boolean => {
|
||||||
|
let selected = this.instance?.enrollmentFlow === flow.pk;
|
||||||
if (
|
if (
|
||||||
!this.instance?.pk &&
|
!this.instance?.pk &&
|
||||||
!this.instance?.enrollmentFlow &&
|
!this.instance?.enrollmentFlow &&
|
||||||
|
@ -397,17 +409,11 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
|
||||||
) {
|
) {
|
||||||
selected = true;
|
selected = true;
|
||||||
}
|
}
|
||||||
return html`<option
|
return selected;
|
||||||
value=${ifDefined(flow.pk)}
|
}}
|
||||||
?selected=${selected}
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${flow.name} (${flow.slug})
|
</ak-search-select>
|
||||||
</option>`;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
html`<option>${t`Loading...`}</option>`,
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
<p class="pf-c-form__helper-text">
|
<p class="pf-c-form__helper-text">
|
||||||
${t`Flow to use when enrolling new users.`}
|
${t`Flow to use when enrolling new users.`}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -498,8 +498,8 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
@ -542,8 +542,8 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
@ -588,8 +588,8 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
|
@ -148,8 +148,8 @@ export class AuthenticatorDuoStageForm extends ModelForm<AuthenticatorDuoStage,
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
|
@ -19,7 +19,9 @@ import {
|
||||||
FlowsApi,
|
FlowsApi,
|
||||||
FlowsInstancesListDesignationEnum,
|
FlowsInstancesListDesignationEnum,
|
||||||
FlowsInstancesListRequest,
|
FlowsInstancesListRequest,
|
||||||
|
NotificationWebhookMapping,
|
||||||
PropertymappingsApi,
|
PropertymappingsApi,
|
||||||
|
PropertymappingsNotificationListRequest,
|
||||||
ProviderEnum,
|
ProviderEnum,
|
||||||
StagesApi,
|
StagesApi,
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
@ -160,26 +162,33 @@ export class AuthenticatorSMSStageForm extends ModelForm<AuthenticatorSMSStage,
|
||||||
</p>
|
</p>
|
||||||
</ak-form-element-horizontal>
|
</ak-form-element-horizontal>
|
||||||
<ak-form-element-horizontal label=${t`Mapping`} name="mapping">
|
<ak-form-element-horizontal label=${t`Mapping`} name="mapping">
|
||||||
<select class="pf-c-form-control">
|
<ak-search-select
|
||||||
<option value="" ?selected=${this.instance?.mapping === undefined}>
|
.fetchObjects=${async (
|
||||||
---------
|
query?: string,
|
||||||
</option>
|
): Promise<NotificationWebhookMapping[]> => {
|
||||||
${until(
|
const args: PropertymappingsNotificationListRequest = {
|
||||||
new PropertymappingsApi(DEFAULT_CONFIG)
|
ordering: "saml_name",
|
||||||
.propertymappingsNotificationList({})
|
};
|
||||||
.then((mappings) => {
|
if (query !== undefined) {
|
||||||
return mappings.results.map((mapping) => {
|
args.search = query;
|
||||||
return html`<option
|
}
|
||||||
value=${ifDefined(mapping.pk)}
|
const items = await new PropertymappingsApi(
|
||||||
?selected=${this.instance?.mapping === mapping.pk}
|
DEFAULT_CONFIG,
|
||||||
|
).propertymappingsNotificationList(args);
|
||||||
|
return items.results;
|
||||||
|
}}
|
||||||
|
.renderElement=${(item: NotificationWebhookMapping): string => {
|
||||||
|
return item.name;
|
||||||
|
}}
|
||||||
|
.value=${(item: NotificationWebhookMapping | undefined): string | undefined => {
|
||||||
|
return item?.pk;
|
||||||
|
}}
|
||||||
|
.selected=${(item: NotificationWebhookMapping): boolean => {
|
||||||
|
return this.instance?.mapping === item.pk;
|
||||||
|
}}
|
||||||
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${mapping.name}
|
</ak-search-select>
|
||||||
</option>`;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
html`<option>${t`Loading...`}</option>`,
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
<p class="pf-c-form__helper-text">
|
<p class="pf-c-form__helper-text">
|
||||||
${t`Modify the payload sent to the custom provider.`}
|
${t`Modify the payload sent to the custom provider.`}
|
||||||
</p>
|
</p>
|
||||||
|
@ -279,8 +288,8 @@ export class AuthenticatorSMSStageForm extends ModelForm<AuthenticatorSMSStage,
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
|
@ -95,8 +95,8 @@ export class AuthenticatorStaticStageForm extends ModelForm<AuthenticatorStaticS
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
|
@ -100,8 +100,8 @@ export class AuthenticatorTOTPStageForm extends ModelForm<AuthenticatorTOTPStage
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
|
@ -174,8 +174,8 @@ export class AuthenticateWebAuthnStageForm extends ModelForm<AuthenticateWebAuth
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
||||||
import { first } from "@goauthentik/common/utils";
|
import { first, groupBy } from "@goauthentik/common/utils";
|
||||||
|
import "@goauthentik/elements/SearchSelect";
|
||||||
import "@goauthentik/elements/forms/FormGroup";
|
import "@goauthentik/elements/forms/FormGroup";
|
||||||
import "@goauthentik/elements/forms/HorizontalFormElement";
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
||||||
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
||||||
|
@ -12,11 +13,15 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
||||||
import { until } from "lit/directives/until.js";
|
import { until } from "lit/directives/until.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
Flow,
|
||||||
FlowsApi,
|
FlowsApi,
|
||||||
FlowsInstancesListDesignationEnum,
|
FlowsInstancesListDesignationEnum,
|
||||||
|
FlowsInstancesListRequest,
|
||||||
IdentificationStage,
|
IdentificationStage,
|
||||||
SourcesApi,
|
SourcesApi,
|
||||||
|
Stage,
|
||||||
StagesApi,
|
StagesApi,
|
||||||
|
StagesPasswordListRequest,
|
||||||
UserFieldsEnum,
|
UserFieldsEnum,
|
||||||
} from "@goauthentik/api";
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
|
@ -102,33 +107,34 @@ export class IdentificationStageForm extends ModelForm<IdentificationStage, stri
|
||||||
</p>
|
</p>
|
||||||
</ak-form-element-horizontal>
|
</ak-form-element-horizontal>
|
||||||
<ak-form-element-horizontal label=${t`Password stage`} name="passwordStage">
|
<ak-form-element-horizontal label=${t`Password stage`} name="passwordStage">
|
||||||
<select class="pf-c-form-control">
|
<ak-search-select
|
||||||
<option
|
.fetchObjects=${async (query?: string): Promise<Stage[]> => {
|
||||||
value=""
|
const args: StagesPasswordListRequest = {
|
||||||
?selected=${this.instance?.passwordStage === undefined}
|
|
||||||
>
|
|
||||||
---------
|
|
||||||
</option>
|
|
||||||
${until(
|
|
||||||
new StagesApi(DEFAULT_CONFIG)
|
|
||||||
.stagesPasswordList({
|
|
||||||
ordering: "name",
|
ordering: "name",
|
||||||
})
|
};
|
||||||
.then((stages) => {
|
if (query !== undefined) {
|
||||||
return stages.results.map((stage) => {
|
args.search = query;
|
||||||
const selected =
|
}
|
||||||
this.instance?.passwordStage === stage.pk;
|
const stages = await new StagesApi(
|
||||||
return html`<option
|
DEFAULT_CONFIG,
|
||||||
value=${ifDefined(stage.pk)}
|
).stagesPasswordList(args);
|
||||||
?selected=${selected}
|
return stages.results;
|
||||||
|
}}
|
||||||
|
.groupBy=${(items: Stage[]) => {
|
||||||
|
return groupBy(items, (stage) => stage.verboseNamePlural);
|
||||||
|
}}
|
||||||
|
.renderElement=${(stage: Stage): string => {
|
||||||
|
return stage.name;
|
||||||
|
}}
|
||||||
|
.value=${(stage: Stage | undefined): string | undefined => {
|
||||||
|
return stage?.pk;
|
||||||
|
}}
|
||||||
|
.selected=${(stage: Stage): boolean => {
|
||||||
|
return stage.pk === this.instance?.passwordStage;
|
||||||
|
}}
|
||||||
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${stage.name}
|
</ak-search-select>
|
||||||
</option>`;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
html`<option>${t`Loading...`}</option>`,
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
<p class="pf-c-form__helper-text">
|
<p class="pf-c-form__helper-text">
|
||||||
${t`When selected, a password field is shown on the same page instead of a separate page. This prevents username enumeration attacks.`}
|
${t`When selected, a password field is shown on the same page instead of a separate page. This prevents username enumeration attacks.`}
|
||||||
</p>
|
</p>
|
||||||
|
@ -226,98 +232,103 @@ export class IdentificationStageForm extends ModelForm<IdentificationStage, stri
|
||||||
label=${t`Passwordless flow`}
|
label=${t`Passwordless flow`}
|
||||||
name="passwordlessFlow"
|
name="passwordlessFlow"
|
||||||
>
|
>
|
||||||
<select class="pf-c-form-control">
|
<ak-search-select
|
||||||
<option
|
.fetchObjects=${async (query?: string): Promise<Flow[]> => {
|
||||||
value=""
|
const args: FlowsInstancesListRequest = {
|
||||||
?selected=${this.instance?.passwordlessFlow === undefined}
|
|
||||||
>
|
|
||||||
---------
|
|
||||||
</option>
|
|
||||||
${until(
|
|
||||||
new FlowsApi(DEFAULT_CONFIG)
|
|
||||||
.flowsInstancesList({
|
|
||||||
ordering: "slug",
|
ordering: "slug",
|
||||||
designation:
|
designation: FlowsInstancesListDesignationEnum.Authentication,
|
||||||
FlowsInstancesListDesignationEnum.Authentication,
|
};
|
||||||
})
|
if (query !== undefined) {
|
||||||
.then((flows) => {
|
args.search = query;
|
||||||
return flows.results.map((flow) => {
|
}
|
||||||
const selected =
|
const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList(
|
||||||
this.instance?.passwordlessFlow === flow.pk;
|
args,
|
||||||
return html`<option
|
);
|
||||||
value=${ifDefined(flow.pk)}
|
return flows.results;
|
||||||
?selected=${selected}
|
}}
|
||||||
|
.renderElement=${(flow: Flow): string => {
|
||||||
|
return flow.name;
|
||||||
|
}}
|
||||||
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
|
return html`${flow.slug}`;
|
||||||
|
}}
|
||||||
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
|
return flow?.pk;
|
||||||
|
}}
|
||||||
|
.selected=${(flow: Flow): boolean => {
|
||||||
|
return this.instance?.passwordlessFlow == flow.pk;
|
||||||
|
}}
|
||||||
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${flow.name} (${flow.slug})
|
</ak-search-select>
|
||||||
</option>`;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
html`<option>${t`Loading...`}</option>`,
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
<p class="pf-c-form__helper-text">
|
<p class="pf-c-form__helper-text">
|
||||||
${t`Optional passwordless flow, which is linked at the bottom of the page. When configured, users can use this flow to authenticate with a WebAuthn authenticator, without entering any details.`}
|
${t`Optional passwordless flow, which is linked at the bottom of the page. When configured, users can use this flow to authenticate with a WebAuthn authenticator, without entering any details.`}
|
||||||
</p>
|
</p>
|
||||||
</ak-form-element-horizontal>
|
</ak-form-element-horizontal>
|
||||||
<ak-form-element-horizontal label=${t`Enrollment flow`} name="enrollmentFlow">
|
<ak-form-element-horizontal label=${t`Enrollment flow`} name="enrollmentFlow">
|
||||||
<select class="pf-c-form-control">
|
<ak-search-select
|
||||||
<option
|
.fetchObjects=${async (query?: string): Promise<Flow[]> => {
|
||||||
value=""
|
const args: FlowsInstancesListRequest = {
|
||||||
?selected=${this.instance?.enrollmentFlow === undefined}
|
|
||||||
>
|
|
||||||
---------
|
|
||||||
</option>
|
|
||||||
${until(
|
|
||||||
new FlowsApi(DEFAULT_CONFIG)
|
|
||||||
.flowsInstancesList({
|
|
||||||
ordering: "slug",
|
ordering: "slug",
|
||||||
designation: FlowsInstancesListDesignationEnum.Enrollment,
|
designation: FlowsInstancesListDesignationEnum.Enrollment,
|
||||||
})
|
};
|
||||||
.then((flows) => {
|
if (query !== undefined) {
|
||||||
return flows.results.map((flow) => {
|
args.search = query;
|
||||||
const selected =
|
}
|
||||||
this.instance?.enrollmentFlow === flow.pk;
|
const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList(
|
||||||
return html`<option
|
args,
|
||||||
value=${ifDefined(flow.pk)}
|
);
|
||||||
?selected=${selected}
|
return flows.results;
|
||||||
|
}}
|
||||||
|
.renderElement=${(flow: Flow): string => {
|
||||||
|
return flow.name;
|
||||||
|
}}
|
||||||
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
|
return html`${flow.slug}`;
|
||||||
|
}}
|
||||||
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
|
return flow?.pk;
|
||||||
|
}}
|
||||||
|
.selected=${(flow: Flow): boolean => {
|
||||||
|
return this.instance?.enrollmentFlow == flow.pk;
|
||||||
|
}}
|
||||||
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${flow.name} (${flow.slug})
|
</ak-search-select>
|
||||||
</option>`;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
html`<option>${t`Loading...`}</option>`,
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
<p class="pf-c-form__helper-text">
|
<p class="pf-c-form__helper-text">
|
||||||
${t`Optional enrollment flow, which is linked at the bottom of the page.`}
|
${t`Optional enrollment flow, which is linked at the bottom of the page.`}
|
||||||
</p>
|
</p>
|
||||||
</ak-form-element-horizontal>
|
</ak-form-element-horizontal>
|
||||||
<ak-form-element-horizontal label=${t`Recovery flow`} name="recoveryFlow">
|
<ak-form-element-horizontal label=${t`Recovery flow`} name="recoveryFlow">
|
||||||
<select class="pf-c-form-control">
|
<ak-search-select
|
||||||
<option value="" ?selected=${this.instance?.recoveryFlow === undefined}>
|
.fetchObjects=${async (query?: string): Promise<Flow[]> => {
|
||||||
---------
|
const args: FlowsInstancesListRequest = {
|
||||||
</option>
|
|
||||||
${until(
|
|
||||||
new FlowsApi(DEFAULT_CONFIG)
|
|
||||||
.flowsInstancesList({
|
|
||||||
ordering: "slug",
|
ordering: "slug",
|
||||||
designation: FlowsInstancesListDesignationEnum.Recovery,
|
designation: FlowsInstancesListDesignationEnum.Recovery,
|
||||||
})
|
};
|
||||||
.then((flows) => {
|
if (query !== undefined) {
|
||||||
return flows.results.map((flow) => {
|
args.search = query;
|
||||||
const selected =
|
}
|
||||||
this.instance?.recoveryFlow === flow.pk;
|
const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList(
|
||||||
return html`<option
|
args,
|
||||||
value=${ifDefined(flow.pk)}
|
);
|
||||||
?selected=${selected}
|
return flows.results;
|
||||||
|
}}
|
||||||
|
.renderElement=${(flow: Flow): string => {
|
||||||
|
return flow.name;
|
||||||
|
}}
|
||||||
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
|
return html`${flow.slug}`;
|
||||||
|
}}
|
||||||
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
|
return flow?.pk;
|
||||||
|
}}
|
||||||
|
.selected=${(flow: Flow): boolean => {
|
||||||
|
return this.instance?.recoveryFlow == flow.pk;
|
||||||
|
}}
|
||||||
|
?blankable=${true}
|
||||||
>
|
>
|
||||||
${flow.name} (${flow.slug})
|
</ak-search-select>
|
||||||
</option>`;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
html`<option>${t`Loading...`}</option>`,
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
<p class="pf-c-form__helper-text">
|
<p class="pf-c-form__helper-text">
|
||||||
${t`Optional recovery flow, which is linked at the bottom of the page.`}
|
${t`Optional recovery flow, which is linked at the bottom of the page.`}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -90,8 +90,8 @@ export class InvitationForm extends ModelForm<Invitation, string> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
|
@ -138,8 +138,8 @@ export class PasswordStageForm extends ModelForm<PasswordStage, string> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
|
@ -162,8 +162,8 @@ export class TenantForm extends ModelForm<Tenant, string> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
@ -199,8 +199,8 @@ export class TenantForm extends ModelForm<Tenant, string> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
@ -234,8 +234,8 @@ export class TenantForm extends ModelForm<Tenant, string> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
@ -271,8 +271,8 @@ export class TenantForm extends ModelForm<Tenant, string> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
@ -309,8 +309,8 @@ export class TenantForm extends ModelForm<Tenant, string> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
@ -344,8 +344,8 @@ export class TenantForm extends ModelForm<Tenant, string> {
|
||||||
.renderElement=${(flow: Flow): string => {
|
.renderElement=${(flow: Flow): string => {
|
||||||
return flow.name;
|
return flow.name;
|
||||||
}}
|
}}
|
||||||
.renderDescription=${(flow: Flow): string => {
|
.renderDescription=${(flow: Flow): TemplateResult => {
|
||||||
return flow.slug;
|
return html`${flow.slug}`;
|
||||||
}}
|
}}
|
||||||
.value=${(flow: Flow | undefined): string | undefined => {
|
.value=${(flow: Flow | undefined): string | undefined => {
|
||||||
return flow?.pk;
|
return flow?.pk;
|
||||||
|
|
Reference in New Issue