web: began rename, but had to stop and go back for a revision.

This commit is contained in:
Ken Sternberg 2023-12-04 10:19:02 -08:00
parent c52fa631b4
commit 21b50838db
18 changed files with 98 additions and 103 deletions

View File

@ -6,7 +6,7 @@ import "@goauthentik/components/ak-number-input";
import "@goauthentik/components/ak-radio-input"; import "@goauthentik/components/ak-radio-input";
import "@goauthentik/components/ak-switch-input"; import "@goauthentik/components/ak-switch-input";
import "@goauthentik/components/ak-text-input"; import "@goauthentik/components/ak-text-input";
import { WithTenantConfig } from "@goauthentik/elements/Interface/tenantProvider"; import { WithBrandConfig } from "@goauthentik/elements/Interface/brandProvider";
import "@goauthentik/elements/forms/FormGroup"; import "@goauthentik/elements/forms/FormGroup";
import "@goauthentik/elements/forms/HorizontalFormElement"; import "@goauthentik/elements/forms/HorizontalFormElement";
@ -31,7 +31,7 @@ import {
} from "./LDAPOptionsAndHelp"; } from "./LDAPOptionsAndHelp";
@customElement("ak-application-wizard-authentication-by-ldap") @customElement("ak-application-wizard-authentication-by-ldap")
export class ApplicationWizardApplicationDetails extends WithTenantConfig(BaseProviderPanel, true) { export class ApplicationWizardApplicationDetails extends WithBrandConfig(BaseProviderPanel) {
render() { render() {
const provider = this.wizard.provider as LDAPProvider | undefined; const provider = this.wizard.provider as LDAPProvider | undefined;
@ -52,7 +52,7 @@ export class ApplicationWizardApplicationDetails extends WithTenantConfig(BasePr
<ak-tenanted-flow-search <ak-tenanted-flow-search
flowType=${FlowsInstancesListDesignationEnum.Authentication} flowType=${FlowsInstancesListDesignationEnum.Authentication}
.currentFlow=${provider?.authorizationFlow} .currentFlow=${provider?.authorizationFlow}
.tenantFlow=${this.tenant.flowAuthentication} .tenantFlow=${this.brand.flowAuthentication}
required required
></ak-tenanted-flow-search> ></ak-tenanted-flow-search>
<p class="pf-c-form__helper-text">${msg("Flow used for users to authenticate.")}</p> <p class="pf-c-form__helper-text">${msg("Flow used for users to authenticate.")}</p>

View File

@ -2,7 +2,7 @@ import "@goauthentik/admin/common/ak-crypto-certificate-search";
import "@goauthentik/admin/common/ak-flow-search/ak-tenanted-flow-search"; import "@goauthentik/admin/common/ak-flow-search/ak-tenanted-flow-search";
import { ascii_letters, digits, first, randomString } from "@goauthentik/common/utils"; import { ascii_letters, digits, first, randomString } from "@goauthentik/common/utils";
import "@goauthentik/components/ak-text-input"; import "@goauthentik/components/ak-text-input";
import { WithTenantConfig } from "@goauthentik/elements/Interface/tenantProvider"; import { WithBrandConfig } from "@goauthentik/elements/Interface/brandProvider";
import "@goauthentik/elements/forms/FormGroup"; import "@goauthentik/elements/forms/FormGroup";
import "@goauthentik/elements/forms/HorizontalFormElement"; import "@goauthentik/elements/forms/HorizontalFormElement";
@ -16,10 +16,7 @@ import { FlowsInstancesListDesignationEnum, RadiusProvider } from "@goauthentik/
import BaseProviderPanel from "../BaseProviderPanel"; import BaseProviderPanel from "../BaseProviderPanel";
@customElement("ak-application-wizard-authentication-by-radius") @customElement("ak-application-wizard-authentication-by-radius")
export class ApplicationWizardAuthenticationByRadius extends WithTenantConfig( export class ApplicationWizardAuthenticationByRadius extends WithBrandConfig(BaseProviderPanel) {
BaseProviderPanel,
true,
) {
render() { render() {
const provider = this.wizard.provider as RadiusProvider | undefined; const provider = this.wizard.provider as RadiusProvider | undefined;
@ -40,7 +37,7 @@ export class ApplicationWizardAuthenticationByRadius extends WithTenantConfig(
<ak-tenanted-flow-search <ak-tenanted-flow-search
flowType=${FlowsInstancesListDesignationEnum.Authentication} flowType=${FlowsInstancesListDesignationEnum.Authentication}
.currentFlow=${provider?.authorizationFlow} .currentFlow=${provider?.authorizationFlow}
.tenantFlow=${this.tenant.flowAuthentication} .tenantFlow=${this.brand.flowAuthentication}
required required
></ak-tenanted-flow-search> ></ak-tenanted-flow-search>
<p class="pf-c-form__helper-text">${msg("Flow used for users to authenticate.")}</p> <p class="pf-c-form__helper-text">${msg("Flow used for users to authenticate.")}</p>

View File

@ -9,11 +9,11 @@ import { MessageLevel } from "@goauthentik/common/messages";
import { uiConfig } from "@goauthentik/common/ui/config"; import { uiConfig } from "@goauthentik/common/ui/config";
import { first } from "@goauthentik/common/utils"; import { first } from "@goauthentik/common/utils";
import "@goauthentik/components/ak-status-label"; import "@goauthentik/components/ak-status-label";
import { WithBrandConfig } from "@goauthentik/elements/Interface/brandProvider";
import { import {
CapabilitiesEnum, CapabilitiesEnum,
WithCapabilitiesConfig, WithCapabilitiesConfig,
} from "@goauthentik/elements/Interface/capabilitiesProvider"; } from "@goauthentik/elements/Interface/capabilitiesProvider";
import { WithTenantConfig } from "@goauthentik/elements/Interface/tenantProvider";
import "@goauthentik/elements/buttons/ActionButton"; import "@goauthentik/elements/buttons/ActionButton";
import "@goauthentik/elements/buttons/Dropdown"; import "@goauthentik/elements/buttons/Dropdown";
import "@goauthentik/elements/forms/DeleteBulkForm"; import "@goauthentik/elements/forms/DeleteBulkForm";
@ -110,9 +110,8 @@ export class RelatedUserAdd extends Form<{ users: number[] }> {
} }
@customElement("ak-user-related-list") @customElement("ak-user-related-list")
export class RelatedUserList extends WithTenantConfig( export class RelatedUserList extends WithBrandConfig(
WithCapabilitiesConfig(Table<User>, true), WithCapabilitiesConfig(Table<User>, true),
true,
) { ) {
expandable = true; expandable = true;
checkbox = true; checkbox = true;
@ -298,7 +297,7 @@ export class RelatedUserList extends WithTenantConfig(
${msg("Set password")} ${msg("Set password")}
</button> </button>
</ak-forms-modal> </ak-forms-modal>
${this.tenant?.flowRecovery ${this.brand?.flowRecovery
? html` ? html`
<ak-action-button <ak-action-button
class="pf-m-secondary" class="pf-m-secondary"

View File

@ -2,7 +2,7 @@ import "@goauthentik/admin/common/ak-crypto-certificate-search";
import "@goauthentik/admin/common/ak-flow-search/ak-tenanted-flow-search"; import "@goauthentik/admin/common/ak-flow-search/ak-tenanted-flow-search";
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
import { first } from "@goauthentik/common/utils"; import { first } from "@goauthentik/common/utils";
import { WithTenantConfig } from "@goauthentik/elements/Interface/tenantProvider"; import { WithBrandConfig } from "@goauthentik/elements/Interface/brandProvider";
import "@goauthentik/elements/forms/FormGroup"; import "@goauthentik/elements/forms/FormGroup";
import "@goauthentik/elements/forms/HorizontalFormElement"; import "@goauthentik/elements/forms/HorizontalFormElement";
import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
@ -25,7 +25,7 @@ import {
} from "@goauthentik/api"; } from "@goauthentik/api";
@customElement("ak-provider-ldap-form") @customElement("ak-provider-ldap-form")
export class LDAPProviderFormPage extends WithTenantConfig(ModelForm<LDAPProvider, number>, true) { export class LDAPProviderFormPage extends WithBrandConfig(ModelForm<LDAPProvider, number>, true) {
async loadInstance(pk: number): Promise<LDAPProvider> { async loadInstance(pk: number): Promise<LDAPProvider> {
return new ProvidersApi(DEFAULT_CONFIG).providersLdapRetrieve({ return new ProvidersApi(DEFAULT_CONFIG).providersLdapRetrieve({
id: pk, id: pk,
@ -76,7 +76,7 @@ export class LDAPProviderFormPage extends WithTenantConfig(ModelForm<LDAPProvide
<ak-tenanted-flow-search <ak-tenanted-flow-search
flowType=${FlowsInstancesListDesignationEnum.Authentication} flowType=${FlowsInstancesListDesignationEnum.Authentication}
.currentFlow=${this.instance?.authorizationFlow} .currentFlow=${this.instance?.authorizationFlow}
.tenantFlow=${this.tenant?.flowAuthentication} .tenantFlow=${this.brand?.flowAuthentication}
required required
></ak-tenanted-flow-search> ></ak-tenanted-flow-search>
<p class="pf-c-form__helper-text">${msg("Flow used for users to authenticate.")}</p> <p class="pf-c-form__helper-text">${msg("Flow used for users to authenticate.")}</p>

View File

@ -1,6 +1,6 @@
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
import { ascii_letters, digits, first, randomString } from "@goauthentik/common/utils"; import { ascii_letters, digits, first, randomString } from "@goauthentik/common/utils";
import { WithTenantConfig } from "@goauthentik/elements/Interface/tenantProvider"; import { WithBrandConfig } from "@goauthentik/elements/Interface/brandProvider";
import "@goauthentik/elements/forms/FormGroup"; import "@goauthentik/elements/forms/FormGroup";
import "@goauthentik/elements/forms/HorizontalFormElement"; import "@goauthentik/elements/forms/HorizontalFormElement";
import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
@ -14,7 +14,7 @@ import { customElement } from "lit/decorators.js";
import { FlowsInstancesListDesignationEnum, ProvidersApi, RadiusProvider } from "@goauthentik/api"; import { FlowsInstancesListDesignationEnum, ProvidersApi, RadiusProvider } from "@goauthentik/api";
@customElement("ak-provider-radius-form") @customElement("ak-provider-radius-form")
export class RadiusProviderFormPage extends WithTenantConfig( export class RadiusProviderFormPage extends WithBrandConfig(
ModelForm<RadiusProvider, number>, ModelForm<RadiusProvider, number>,
true, true,
) { ) {
@ -68,7 +68,7 @@ export class RadiusProviderFormPage extends WithTenantConfig(
<ak-tenanted-flow-search <ak-tenanted-flow-search
flowType=${FlowsInstancesListDesignationEnum.Authentication} flowType=${FlowsInstancesListDesignationEnum.Authentication}
.currentFlow=${this.instance?.authorizationFlow} .currentFlow=${this.instance?.authorizationFlow}
.tenantFlow=${this.tenant?.flowAuthentication} .tenantFlow=${this.brand?.flowAuthentication}
required required
></ak-tenanted-flow-search> ></ak-tenanted-flow-search>
<p class="pf-c-form__helper-text">${msg("Flow used for users to authenticate.")}</p> <p class="pf-c-form__helper-text">${msg("Flow used for users to authenticate.")}</p>

View File

@ -12,11 +12,11 @@ import { DefaultUIConfig, uiConfig } from "@goauthentik/common/ui/config";
import { first } from "@goauthentik/common/utils"; import { first } from "@goauthentik/common/utils";
import "@goauthentik/components/ak-status-label"; import "@goauthentik/components/ak-status-label";
import { rootInterface } from "@goauthentik/elements/Base"; import { rootInterface } from "@goauthentik/elements/Base";
import { WithBrandConfig } from "@goauthentik/elements/Interface/brandProvider";
import { import {
CapabilitiesEnum, CapabilitiesEnum,
WithCapabilitiesConfig, WithCapabilitiesConfig,
} from "@goauthentik/elements/Interface/capabilitiesProvider"; } from "@goauthentik/elements/Interface/capabilitiesProvider";
import { WithTenantConfig } from "@goauthentik/elements/Interface/tenantProvider";
import { PFSize } from "@goauthentik/elements/Spinner"; import { PFSize } from "@goauthentik/elements/Spinner";
import "@goauthentik/elements/TreeView"; import "@goauthentik/elements/TreeView";
import "@goauthentik/elements/buttons/ActionButton"; import "@goauthentik/elements/buttons/ActionButton";
@ -91,10 +91,8 @@ const recoveryButtonStyles = css`
`; `;
@customElement("ak-user-list") @customElement("ak-user-list")
export class UserListPage extends WithTenantConfig( export class UserListPage extends WithBrandConfig(
WithCapabilitiesConfig(TablePage<User>, true), WithCapabilitiesConfig(TablePage<User>, true)) {
true,
) {
expandable = true; expandable = true;
checkbox = true; checkbox = true;
@ -355,7 +353,7 @@ export class UserListPage extends WithTenantConfig(
${msg("Set password")} ${msg("Set password")}
</button> </button>
</ak-forms-modal> </ak-forms-modal>
${this.tenant.flowRecovery ${this.brand.flowRecovery
? html` ? html`
<ak-action-button <ak-action-button
class="pf-m-secondary" class="pf-m-secondary"

View File

@ -6,7 +6,13 @@ import {
import { EVENT_LOCALE_REQUEST, EVENT_REFRESH, VERSION } from "@goauthentik/common/constants"; import { EVENT_LOCALE_REQUEST, EVENT_REFRESH, VERSION } from "@goauthentik/common/constants";
import { globalAK } from "@goauthentik/common/global"; import { globalAK } from "@goauthentik/common/global";
import { Config, Configuration, CoreApi, CurrentTenant, RootApi } from "@goauthentik/api"; import {
Config,
Configuration,
CoreApi,
CurrentTenant as CurrentBrand,
RootApi,
} from "@goauthentik/api";
let globalConfigPromise: Promise<Config> | undefined = Promise.resolve(globalAK().config); let globalConfigPromise: Promise<Config> | undefined = Promise.resolve(globalAK().config);
export function config(): Promise<Config> { export function config(): Promise<Config> {
@ -16,7 +22,7 @@ export function config(): Promise<Config> {
return globalConfigPromise; return globalConfigPromise;
} }
export function tenantSetFavicon(tenant: CurrentTenant) { export function brandSetFavicon(brand: CurrentBrand) {
/** /**
* <link rel="icon" href="/static/dist/assets/icons/icon.png"> * <link rel="icon" href="/static/dist/assets/icons/icon.png">
* <link rel="shortcut icon" href="/static/dist/assets/icons/icon.png"> * <link rel="shortcut icon" href="/static/dist/assets/icons/icon.png">
@ -29,36 +35,36 @@ export function tenantSetFavicon(tenant: CurrentTenant) {
relIcon.rel = rel; relIcon.rel = rel;
document.getElementsByTagName("head")[0].appendChild(relIcon); document.getElementsByTagName("head")[0].appendChild(relIcon);
} }
relIcon.href = tenant.brandingFavicon; relIcon.href = brand.brandingFavicon;
}); });
} }
export function tenantSetLocale(tenant: CurrentTenant) { export function brandSetLocale(brand: CurrentBrand) {
if (tenant.defaultLocale === "") { if (brand.defaultLocale === "") {
return; return;
} }
console.debug("authentik/locale: setting locale from tenant default"); console.debug("authentik/locale: setting locale from brand default");
window.dispatchEvent( window.dispatchEvent(
new CustomEvent(EVENT_LOCALE_REQUEST, { new CustomEvent(EVENT_LOCALE_REQUEST, {
composed: true, composed: true,
bubbles: true, bubbles: true,
detail: { locale: tenant.defaultLocale }, detail: { locale: brand.defaultLocale },
}), }),
); );
} }
let globalTenantPromise: Promise<CurrentTenant> | undefined = Promise.resolve(globalAK().tenant); let globalBrandPromise: Promise<CurrentBrand> | undefined = Promise.resolve(globalAK().tenant);
export function tenant(): Promise<CurrentTenant> { export function brand(): Promise<CurrentBrand> {
if (!globalTenantPromise) { if (!globalBrandPromise) {
globalTenantPromise = new CoreApi(DEFAULT_CONFIG) globalBrandPromise = new CoreApi(DEFAULT_CONFIG)
.coreTenantsCurrentRetrieve() .coreTenantsCurrentRetrieve()
.then((tenant) => { .then((brand) => {
tenantSetFavicon(tenant); brandSetFavicon(brand);
tenantSetLocale(tenant); brandSetLocale(brand);
return tenant; return brand;
}); });
} }
return globalTenantPromise; return globalBrandPromise;
} }
export function getMetaContent(key: string): string { export function getMetaContent(key: string): string {
@ -90,9 +96,9 @@ window.addEventListener(EVENT_REFRESH, () => {
// Upon global refresh, disregard whatever was pre-hydrated and // Upon global refresh, disregard whatever was pre-hydrated and
// actually load info from API // actually load info from API
globalConfigPromise = undefined; globalConfigPromise = undefined;
globalTenantPromise = undefined; globalBrandPromise = undefined;
config(); config();
tenant(); brand();
}); });
console.debug(`authentik(early): version ${VERSION}, apiBase ${DEFAULT_CONFIG.basePath}`); console.debug(`authentik(early): version ${VERSION}, apiBase ${DEFAULT_CONFIG.basePath}`);

View File

@ -18,13 +18,13 @@ export interface RequestInfo {
} }
export class LoggingMiddleware implements Middleware { export class LoggingMiddleware implements Middleware {
tenant: CurrentTenant; brand: CurrentTenant;
constructor(tenant: CurrentTenant) { constructor(brand: CurrentTenant) {
this.tenant = tenant; this.brand = brand;
} }
post(context: ResponseContext): Promise<Response | void> { post(context: ResponseContext): Promise<Response | void> {
let msg = `authentik/api[${this.tenant.matchedDomain}]: `; let msg = `authentik/api[${this.brand.matchedDomain}]: `;
// https://developer.mozilla.org/en-US/docs/Web/API/console#styling_console_output // https://developer.mozilla.org/en-US/docs/Web/API/console#styling_console_output
msg += `%c${context.response.status}%c ${context.init.method} ${context.url}`; msg += `%c${context.response.status}%c ${context.init.method} ${context.url}`;
let style = ""; let style = "";

View File

@ -1,11 +1,9 @@
import { createContext } from "@lit-labs/context"; import { createContext } from "@lit-labs/context";
import type { Config, CurrentTenant } from "@goauthentik/api"; import type { Config, CurrentTenant as CurrentBrand } from "@goauthentik/api";
export const authentikConfigContext = createContext<Config>(Symbol("authentik-config-context")); export const authentikConfigContext = createContext<Config>(Symbol("authentik-config-context"));
export const authentikTenantContext = createContext<CurrentTenant>( export const authentikBrandContext = createContext<CurrentBrand>(Symbol("authentik-brand-context"));
Symbol("authentik-tenant-context"),
);
export default authentikConfigContext; export default authentikConfigContext;

View File

@ -1,8 +1,8 @@
import { config, tenant } from "@goauthentik/common/api/config"; import { brand, config } from "@goauthentik/common/api/config";
import { UIConfig, uiConfig } from "@goauthentik/common/ui/config"; import { UIConfig, uiConfig } from "@goauthentik/common/ui/config";
import { import {
authentikBrandContext,
authentikConfigContext, authentikConfigContext,
authentikTenantContext,
} from "@goauthentik/elements/AuthentikContexts"; } from "@goauthentik/elements/AuthentikContexts";
import type { AdoptedStyleSheetsElement } from "@goauthentik/elements/types"; import type { AdoptedStyleSheetsElement } from "@goauthentik/elements/types";
import { ensureCSSStyleSheet } from "@goauthentik/elements/utils/ensureCSSStyleSheet"; import { ensureCSSStyleSheet } from "@goauthentik/elements/utils/ensureCSSStyleSheet";
@ -12,13 +12,13 @@ import { state } from "lit/decorators.js";
import PFBase from "@patternfly/patternfly/patternfly-base.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css";
import { Config, CurrentTenant, UiThemeEnum } from "@goauthentik/api"; import { Config, CurrentTenant as CurrentBrand, UiThemeEnum } from "@goauthentik/api";
import { AKElement } from "../Base"; import { AKElement } from "../Base";
type AkInterface = HTMLElement & { type AkInterface = HTMLElement & {
getTheme: () => Promise<UiThemeEnum>; getTheme: () => Promise<UiThemeEnum>;
tenant?: CurrentTenant; brand?: CurrentBrand;
uiConfig?: UIConfig; uiConfig?: UIConfig;
config?: Config; config?: Config;
}; };
@ -45,28 +45,28 @@ export class Interface extends AKElement implements AkInterface {
return this._config; return this._config;
} }
_tenantContext = new ContextProvider(this, { _brandContext = new ContextProvider(this, {
context: authentikTenantContext, context: authentikBrandContext,
initialValue: undefined, initialValue: undefined,
}); });
_tenant?: CurrentTenant; _brand?: CurrentBrand;
@state() @state()
set tenant(c: CurrentTenant) { set brand(c: CurrentBrand) {
this._tenant = c; this._brand = c;
this._tenantContext.setValue(c); this._brandContext.setValue(c);
this.requestUpdate(); this.requestUpdate();
} }
get tenant(): CurrentTenant | undefined { get brand(): CurrentBrand | undefined {
return this._tenant; return this._brand;
} }
constructor() { constructor() {
super(); super();
document.adoptedStyleSheets = [...document.adoptedStyleSheets, ensureCSSStyleSheet(PFBase)]; document.adoptedStyleSheets = [...document.adoptedStyleSheets, ensureCSSStyleSheet(PFBase)];
tenant().then((tenant) => (this.tenant = tenant)); brand().then((brand) => (this.brand = brand));
config().then((config) => (this.config = config)); config().then((config) => (this.config = config));
this.dataset.akInterfaceRoot = "true"; this.dataset.akInterfaceRoot = "true";
} }

View File

@ -0,0 +1,20 @@
import { authentikBrandContext } from "@goauthentik/elements/AuthentikContexts";
import { consume } from "@lit-labs/context";
import type { LitElement } from "lit";
import type { CurrentTenant as CurrentBrand } from "@goauthentik/api";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Constructor<T = object> = abstract new (...args: any[]) => T;
export function WithBrandConfig<T extends Constructor<LitElement>>(
superclass: T,
subscribe = true,
) {
abstract class WithBrandProvider extends superclass {
@consume({ context: authentikBrandContext, subscribe })
public brand!: CurrentBrand;
}
return WithBrandProvider;
}

View File

@ -1,20 +0,0 @@
import { authentikTenantContext } from "@goauthentik/elements/AuthentikContexts";
import { consume } from "@lit-labs/context";
import type { LitElement } from "lit";
import type { CurrentTenant } from "@goauthentik/api";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Constructor<T = object> = abstract new (...args: any[]) => T;
export function WithTenantConfig<T extends Constructor<LitElement>>(
superclass: T,
subscribe = false,
) {
abstract class WithTenantProvider extends superclass {
@consume({ context: authentikTenantContext, subscribe })
public tenant!: CurrentTenant;
}
return WithTenantProvider;
}

View File

@ -9,7 +9,7 @@ import {
import { currentInterface } from "@goauthentik/common/sentry"; import { currentInterface } from "@goauthentik/common/sentry";
import { me } from "@goauthentik/common/users"; import { me } from "@goauthentik/common/users";
import { AKElement } from "@goauthentik/elements/Base"; import { AKElement } from "@goauthentik/elements/Base";
import { WithTenantConfig } from "@goauthentik/elements/Interface/tenantProvider"; import { WithBrandConfig } from "@goauthentik/elements/Interface/brandProvider";
import "@patternfly/elements/pf-tooltip/pf-tooltip.js"; import "@patternfly/elements/pf-tooltip/pf-tooltip.js";
import { msg } from "@lit/localize"; import { msg } from "@lit/localize";
@ -24,7 +24,7 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css";
import { EventsApi } from "@goauthentik/api"; import { EventsApi } from "@goauthentik/api";
@customElement("ak-page-header") @customElement("ak-page-header")
export class PageHeader extends WithTenantConfig(AKElement, true) { export class PageHeader extends WithBrandConfig(AKElement) {
@property() @property()
icon?: string; icon?: string;
@ -37,7 +37,7 @@ export class PageHeader extends WithTenantConfig(AKElement, true) {
@property() @property()
set header(value: string) { set header(value: string) {
const currentIf = currentInterface(); const currentIf = currentInterface();
let title = this.tenant?.brandingTitle || TITLE_DEFAULT; let title = this.brand?.brandingTitle || TITLE_DEFAULT;
if (currentIf === "admin") { if (currentIf === "admin") {
title = `${msg("Admin")} - ${title}`; title = `${msg("Admin")} - ${title}`;
} }

View File

@ -1,6 +1,6 @@
import { EVENT_SIDEBAR_TOGGLE } from "@goauthentik/common/constants"; import { EVENT_SIDEBAR_TOGGLE } from "@goauthentik/common/constants";
import { AKElement } from "@goauthentik/elements/Base"; import { AKElement } from "@goauthentik/elements/Base";
import { WithTenantConfig } from "@goauthentik/elements/Interface/tenantProvider"; import { WithBrandConfig } from "@goauthentik/elements/Interface/brandProvider";
import { CSSResult, TemplateResult, css, html } from "lit"; import { CSSResult, TemplateResult, css, html } from "lit";
import { customElement } from "lit/decorators.js"; import { customElement } from "lit/decorators.js";
@ -27,7 +27,7 @@ export const DefaultTenant: CurrentTenant = {
}; };
@customElement("ak-sidebar-brand") @customElement("ak-sidebar-brand")
export class SidebarBrand extends WithTenantConfig(AKElement, true) { export class SidebarBrand extends WithBrandConfig(AKElement) {
static get styles(): CSSResult[] { static get styles(): CSSResult[] {
return [ return [
PFBase, PFBase,
@ -85,7 +85,7 @@ export class SidebarBrand extends WithTenantConfig(AKElement, true) {
<a href="#/" class="pf-c-page__header-brand-link"> <a href="#/" class="pf-c-page__header-brand-link">
<div class="pf-c-brand ak-brand"> <div class="pf-c-brand ak-brand">
<img <img
src=${this.tenant?.brandingLogo ?? DefaultTenant.brandingLogo} src=${this.brand?.brandingLogo ?? DefaultTenant.brandingLogo}
alt="authentik Logo" alt="authentik Logo"
loading="lazy" loading="lazy"
/> />

View File

@ -54,9 +54,9 @@ export class FlowExecutor extends Interface implements StageHost {
set challenge(value: ChallengeTypes | undefined) { set challenge(value: ChallengeTypes | undefined) {
this._challenge = value; this._challenge = value;
if (value?.flowInfo?.title) { if (value?.flowInfo?.title) {
document.title = `${value.flowInfo?.title} - ${this.tenant?.brandingTitle}`; document.title = `${value.flowInfo?.title} - ${this.brand?.brandingTitle}`;
} else { } else {
document.title = this.tenant?.brandingTitle || TITLE_DEFAULT; document.title = this.brand?.brandingTitle || TITLE_DEFAULT;
} }
this.requestUpdate(); this.requestUpdate();
} }
@ -500,7 +500,7 @@ export class FlowExecutor extends Interface implements StageHost {
<header class="pf-c-login__header"> <header class="pf-c-login__header">
<div class="pf-c-brand ak-brand"> <div class="pf-c-brand ak-brand">
<img <img
src="${first(this.tenant?.brandingLogo, "")}" src="${first(this.brand?.brandingLogo, "")}"
alt="authentik Logo" alt="authentik Logo"
/> />
</div> </div>
@ -510,7 +510,7 @@ export class FlowExecutor extends Interface implements StageHost {
</div> </div>
<footer class="pf-c-login__footer"> <footer class="pf-c-login__footer">
<ul class="pf-c-list pf-m-inline"> <ul class="pf-c-list pf-m-inline">
${this.tenant?.uiFooterLinks?.map((link) => { ${this.brand?.uiFooterLinks?.map((link) => {
return html`<li> return html`<li>
<a href="${link.href || ""}" <a href="${link.href || ""}"
>${link.name}</a >${link.name}</a

View File

@ -103,7 +103,7 @@ export class APIBrowser extends Interface {
<img <img
alt="authentik Logo" alt="authentik Logo"
class="logo" class="logo"
src="${first(this.tenant?.brandingLogo, DefaultTenant.brandingLogo)}" src="${first(this.brand?.brandingLogo, DefaultTenant.brandingLogo)}"
/> />
</div> </div>
</rapi-doc> </rapi-doc>

View File

@ -192,11 +192,8 @@ export class UserInterface extends Interface {
<a href="#/" class="pf-c-page__header-brand-link"> <a href="#/" class="pf-c-page__header-brand-link">
<img <img
class="pf-c-brand" class="pf-c-brand"
src="${first( src="${first(this.brand?.brandingLogo, DefaultTenant.brandingLogo)}"
this.tenant?.brandingLogo, alt="${(this.brand?.brandingTitle, DefaultTenant.brandingTitle)}"
DefaultTenant.brandingLogo,
)}"
alt="${(this.tenant?.brandingTitle, DefaultTenant.brandingTitle)}"
/> />
</a> </a>
</div> </div>

View File

@ -3,7 +3,7 @@ import { EVENT_REFRESH } from "@goauthentik/common/constants";
import { MessageLevel } from "@goauthentik/common/messages"; import { MessageLevel } from "@goauthentik/common/messages";
import { refreshMe } from "@goauthentik/common/users"; import { refreshMe } from "@goauthentik/common/users";
import { AKElement } from "@goauthentik/elements/Base"; import { AKElement } from "@goauthentik/elements/Base";
import { WithTenantConfig } from "@goauthentik/elements/Interface/tenantProvider"; import { WithBrandConfig } from "@goauthentik/elements/Interface/brandProvider";
import { showMessage } from "@goauthentik/elements/messages/MessageContainer"; import { showMessage } from "@goauthentik/elements/messages/MessageContainer";
import { StageHost } from "@goauthentik/flow/stages/base"; import { StageHost } from "@goauthentik/flow/stages/base";
import "@goauthentik/user/user-settings/details/stages/prompt/PromptStage"; import "@goauthentik/user/user-settings/details/stages/prompt/PromptStage";
@ -32,7 +32,7 @@ import {
@customElement("ak-user-settings-flow-executor") @customElement("ak-user-settings-flow-executor")
export class UserSettingsFlowExecutor export class UserSettingsFlowExecutor
extends WithTenantConfig(AKElement, true) extends WithBrandConfig(AKElement)
implements StageHost implements StageHost
{ {
@property() @property()
@ -87,7 +87,7 @@ export class UserSettingsFlowExecutor
} }
firstUpdated(): void { firstUpdated(): void {
this.flowSlug = this.tenant?.flowUserSettings; this.flowSlug = this.brand?.flowUserSettings;
if (!this.flowSlug) { if (!this.flowSlug) {
return; return;
} }