import { CryptoApi, FlowDesignationEnum, FlowsApi, OAuth2Provider, OAuth2ProviderClientTypeEnum, OAuth2ProviderIssuerModeEnum, OAuth2ProviderJwtAlgEnum, OAuth2ProviderSubModeEnum, PropertymappingsApi, ProvidersApi } from "authentik-api"; import { gettext } from "django"; 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 { until } from "lit-html/directives/until"; import { ifDefined } from "lit-html/directives/if-defined"; import "../../../elements/forms/HorizontalFormElement"; import "../../../elements/forms/FormGroup"; import { first, randomString } from "../../../utils"; @customElement("ak-provider-oauth2-form") export class OAuth2ProviderFormPage extends Form { set providerUUID(value: number) { new ProvidersApi(DEFAULT_CONFIG).providersOauth2Read({ id: value, }).then(provider => { this.provider = provider; }); } @property({attribute: false}) provider?: OAuth2Provider; getSuccessMessage(): string { if (this.provider) { return gettext("Successfully updated provider."); } else { return gettext("Successfully created provider."); } } send = (data: OAuth2Provider): Promise => { if (this.provider) { return new ProvidersApi(DEFAULT_CONFIG).providersOauth2Update({ id: this.provider.pk || 0, data: data }); } else { return new ProvidersApi(DEFAULT_CONFIG).providersOauth2Create({ data: data }); } }; renderForm(): TemplateResult { return html`

${gettext("Flow used when authorizing this provider.")}

${gettext("Protocol settings")}

${gettext("Confidential clients are capable of maintaining the confidentiality of their credentials. Public clients are incapable.")}

${gettext("Advanced protocol settings")}

${gettext("Algorithm used to sign the JWT Tokens.")}

${gettext("Select which scopes can be used by the client. The client stil has to specify the scope to access the data.")}

${gettext("Hold control/command to select multiple items.")}

${gettext("Key used to sign the tokens. Only required when JWT Algorithm is set to RS256.")}

${gettext("Configure what data should be used as unique User Identifier. For most cases, the default should be fine.")}

${gettext("Include User claims from scopes in the id_token, for applications that don't access the userinfo endpoint.")}

${gettext("Configure how the issuer field of the ID Token should be filled.")}

`; } }