import { SAMLPropertyMapping, PropertymappingsApi } from "authentik-api"; import { t } from "@lingui/macro"; import { customElement, property } from "lit-element"; import { html, TemplateResult } from "lit-html"; import { DEFAULT_CONFIG } from "../../api/Config"; import { Form } from "../../elements/forms/Form"; import { ifDefined } from "lit-html/directives/if-defined"; import "../../elements/forms/HorizontalFormElement"; import "../../elements/CodeMirror"; @customElement("ak-property-mapping-saml-form") export class PropertyMappingLDAPForm extends Form { set mappingUUID(value: string) { new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSamlRead({ pmUuid: value, }).then(mapping => { this.mapping = mapping; }); } @property({attribute: false}) mapping?: SAMLPropertyMapping; getSuccessMessage(): string { if (this.mapping) { return t`Successfully updated mapping.`; } else { return t`Successfully created mapping.`; } } send = (data: SAMLPropertyMapping): Promise => { if (this.mapping) { return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSamlUpdate({ pmUuid: this.mapping.pk || "", data: data }); } else { return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsSamlCreate({ data: data }); } }; renderForm(): TemplateResult { return html`

${t`Attribute name used for SAML Assertions. Can be a URN OID, a schema reference, or a any other string. If this property mapping is used for NameID Property, this field is discarded.`}

${t`Optionally set the 'FriendlyName' value of the Assertion attribute.`}

${t`Expression using Python.`} ${t`See documentation for a list of all variables.`}

`; } }