import { FlowsApi, ProvidersApi, LDAPProvider, CoreApi, FlowsInstancesListDesignationEnum, CryptoApi, } from "authentik-api"; import { t } from "@lingui/macro"; import { customElement } from "lit-element"; import { html, TemplateResult } from "lit-html"; import { DEFAULT_CONFIG, tenant } from "../../../api/Config"; import { ModelForm } from "../../../elements/forms/ModelForm"; import { until } from "lit-html/directives/until"; import { ifDefined } from "lit-html/directives/if-defined"; import "../../../elements/forms/HorizontalFormElement"; import "../../../elements/forms/FormGroup"; import { first } from "../../../utils"; @customElement("ak-provider-ldap-form") export class LDAPProviderFormPage extends ModelForm { loadInstance(pk: number): Promise { return new ProvidersApi(DEFAULT_CONFIG).providersLdapRetrieve({ id: pk, }); } getSuccessMessage(): string { if (this.instance) { return t`Successfully updated provider.`; } else { return t`Successfully created provider.`; } } send = (data: LDAPProvider): Promise => { if (this.instance) { return new ProvidersApi(DEFAULT_CONFIG).providersLdapUpdate({ id: this.instance.pk || 0, lDAPProviderRequest: data, }); } else { data.tlsServerName = ""; return new ProvidersApi(DEFAULT_CONFIG).providersLdapCreate({ lDAPProviderRequest: data, }); } }; renderForm(): TemplateResult { return html`

${t`Flow used for users to authenticate. Currently only identification and password stages are supported.`}

${t`Users in the selected group can do search queries. If no group is selected, no LDAP Searches are allowed.`}

${t`Protocol settings`}

${t`LDAP DN under which bind requests and search requests can be made.`}

${t`Due to protocol limitations, this certificate is only used when the outpost has a single provider.`}

${t`If multiple providers share an outpost, a self-signed certificate is used.`}

${t`The start for uidNumbers, this number is added to the user.Pk to make sure that the numbers aren't too low for POSIX users. Default is 2000 to ensure that we don't collide with local users uidNumber`}

${t`The start for gidNumbers, this number is added to a number generated from the group.Pk to make sure that the numbers aren't too low for POSIX groups. Default is 4000 to ensure that we don't collide with local groups or users primary groups gidNumber`}

`; } }