import "@goauthentik/admin/common/ak-crypto-certificate-search"; import "@goauthentik/admin/common/ak-flow-search/ak-flow-search"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; import "@goauthentik/elements/CodeMirror"; import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror"; import "@goauthentik/elements/forms/FormGroup"; import "@goauthentik/elements/forms/HorizontalFormElement"; import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; import "@goauthentik/elements/forms/SearchSelect"; import { DefaultTenant } from "@goauthentik/elements/sidebar/SidebarBrand"; import YAML from "yaml"; import { msg } from "@lit/localize"; import { TemplateResult, html } from "lit"; import { customElement } from "lit/decorators.js"; import { CoreApi, FlowsInstancesListDesignationEnum, Tenant } from "@goauthentik/api"; @customElement("ak-tenant-form") export class TenantForm extends ModelForm { loadInstance(pk: string): Promise { return new CoreApi(DEFAULT_CONFIG).coreTenantsRetrieve({ tenantUuid: pk, }); } getSuccessMessage(): string { return this.instance ? msg("Successfully updated tenant.") : msg("Successfully created tenant."); } async send(data: Tenant): Promise { if (this.instance?.tenantUuid) { return new CoreApi(DEFAULT_CONFIG).coreTenantsUpdate({ tenantUuid: this.instance.tenantUuid, tenantRequest: data, }); } else { return new CoreApi(DEFAULT_CONFIG).coreTenantsCreate({ tenantRequest: data, }); } } renderForm(): TemplateResult { return html`

${msg( "Matching is done based on domain suffix, so if you enter domain.tld, foo.domain.tld will still match.", )}

${msg("Use this tenant for each domain that doesn't have a dedicated tenant.")}

${msg("Branding settings")}

${msg("Branding shown in page title and several other places.")}

${msg("Icon shown in sidebar/header and flow executor.")}

${msg("Icon shown in the browser tab.")}

${msg("Default flows")}

${msg( "Flow used to authenticate users. If left empty, the first applicable flow sorted by the slug is used.", )}

${msg( "Flow used to logout. If left empty, the first applicable flow sorted by the slug is used.", )}

${msg( "Recovery flow. If left empty, the first applicable flow sorted by the slug is used.", )}

${msg( "If set, users are able to unenroll themselves using this flow. If no flow is set, option is not shown.", )}

${msg("If set, users are able to configure details of their profile.")}

${msg( "If set, the OAuth Device Code profile can be used, and the selected flow will be used to enter the code.", )}

${msg("Other global settings")}

${msg("Duration after which events will be deleted from the database.")}

${msg( 'When using an external logging solution for archiving, this can be set to "minutes=5".', )}

${msg( "This setting only affects new Events, as the expiration is saved per-event.", )}

${msg('Format: "weeks=3;days=2;hours=3,seconds=2".')}

${msg( "Set custom attributes using YAML or JSON. Any attributes set here will be inherited by users, if the request is handled by this tenant.", )}

`; } }