import { gettext } from "django"; import { CSSResult, customElement, html, property, TemplateResult } from "lit-element"; import PFPage from "@patternfly/patternfly/components/Page/page.css"; import PFContent from "@patternfly/patternfly/components/Content/content.css"; import PFGallery from "@patternfly/patternfly/layouts/Gallery/gallery.css"; import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import "../../elements/CodeMirror"; import "../../elements/Tabs"; import { Page } from "../../elements/Page"; import { OAuthSource, SourcesApi } from "authentik-api"; import { DEFAULT_CONFIG } from "../../api/Config"; import { AdminURLManager } from "../../api/legacy"; @customElement("ak-source-oauth-view") export class OAuthSourceViewPage extends Page { pageTitle(): string { return gettext(`OAuth Source ${this.source?.name || ""}`); } pageDescription(): string | undefined { return; } pageIcon(): string { return "pf-icon pf-icon-middleware"; } @property({ type: String }) set sourceSlug(value: string) { new SourcesApi(DEFAULT_CONFIG).sourcesOauthRead({ slug: value }).then((source) => { this.source = source; }); } @property({ attribute: false }) source?: OAuthSource; static get styles(): CSSResult[] { return [PFPage, PFGallery, PFContent]; } constructor() { super(); this.addEventListener("ak-refresh", () => { if (!this.source?.pk) return; this.sourceSlug = this.source?.slug; }); } renderContent(): TemplateResult { if (!this.source) { return html``; } return html`
${gettext("Name")}
${this.source.name}
${gettext("Provider Type")}
${this.source.providerType}
${gettext("Callback URL")}
${this.source.callbackUrl}
${gettext("Access Key")}
${this.source.consumerKey}
${gettext("Authorization URL")}
${this.source.authorizationUrl}
${gettext("Token URL")}
${this.source.accessTokenUrl}
`; } }