wip: rename to authentik (#361)

* root: initial rename

* web: rename custom element prefix

* root: rename external functions with pb_ prefix

* root: fix formatting

* root: replace domain with goauthentik.io

* proxy: update path

* root: rename remaining prefixes

* flows: rename file extension

* root: pbadmin -> akadmin

* docs: fix image filenames

* lifecycle: ignore migration files

* ci: copy default config from current source before loading last tagged

* *: new sentry dsn

* tests: fix missing python3.9-dev package

* root: add additional migrations for service accounts created by outposts

* core: mark system-created service accounts with attribute

* policies/expression: fix pb_ replacement not working

* web: fix last linting errors, add lit-analyse

* policies/expressions: fix lint errors

* web: fix sidebar display on screens where not all items fit

* proxy: attempt to fix proxy pipeline

* proxy: use go env GOPATH to get gopath

* lib: fix user_default naming inconsistency

* docs: add upgrade docs

* docs: update screenshots to use authentik

* admin: fix create button on empty-state of outpost

* web: fix modal submit not refreshing SiteShell and Table

* web: fix height of app-card and height of generic icon

* web: fix rendering of subtext

* admin: fix version check error not being caught

* web: fix worker count not being shown

* docs: update screenshots

* root: new icon

* web: fix lint error

* admin: fix linting error

* root: migrate coverage config to pyproject
This commit is contained in:
Jens L
2020-12-05 22:08:42 +01:00
committed by GitHub
parent 810a7ab50b
commit 1cfe1aff13
989 changed files with 6425 additions and 4412 deletions

View File

@ -6,6 +6,7 @@ import { PBResponse } from "../api/client";
import { COMMON_STYLES } from "../common/styles";
import { loading, truncate } from "../utils";
@customElement("ak-library-app")
export class LibraryApplication extends LitElement {
@property({attribute: false})
application?: Application;
@ -13,8 +14,11 @@ export class LibraryApplication extends LitElement {
static get styles(): CSSResult[] {
return COMMON_STYLES.concat(
css`
img.pf-icon {
max-height: 24px;
a {
height: 100%;
}
i.pf-icon {
height: 36px;
}
.pf-c-avatar {
--pf-c-avatar--BorderRadius: 0;
@ -25,7 +29,7 @@ export class LibraryApplication extends LitElement {
render(): TemplateResult {
if (!this.application) {
return html`<pb-spinner></pb-spinner>`;
return html`<ak-spinner></ak-spinner>`;
}
return html` <a href="${this.application.launch_url}" class="pf-c-card pf-m-hoverable pf-m-compact">
<div class="pf-c-card__header">
@ -45,7 +49,7 @@ export class LibraryApplication extends LitElement {
}
@customElement("pb-library")
@customElement("ak-library")
export class LibraryPage extends LitElement {
@property({attribute: false})
apps?: PBResponse<Application>;
@ -72,7 +76,7 @@ export class LibraryPage extends LitElement {
renderApps(): TemplateResult {
return html`<div class="pf-l-gallery pf-m-gutter">
${this.apps?.results.map((app) => html`<pb-library-app application=${app}></pb-library-app>`)}
${this.apps?.results.map((app) => html`<ak-library-app .application=${app}></ak-library-app>`)}
</div>`;
}

View File

@ -10,7 +10,7 @@ import { SpinnerSize } from "../../elements/Spinner";
import "../../elements/AdminLoginsChart";
import "./TopApplicationsTable";
@customElement("pb-admin-status-card")
@customElement("ak-admin-status-card")
export class AdminStatusCard extends AggregatePromiseCard {
@property({type: Number})
@ -23,17 +23,17 @@ export class AdminStatusCard extends AggregatePromiseCard {
lessThanThreshold?: number;
renderNone(): TemplateResult {
return html`<pb-spinner size=${SpinnerSize.Large}></pb-spinner>`;
return html`<ak-spinner size=${SpinnerSize.Large}></ak-spinner>`;
}
renderGood(): TemplateResult {
return html`<p class="pb-aggregate-card">
return html`<p class="ak-aggregate-card">
<i class="fa fa-check-circle"></i> ${this.value}
</p>`;
}
renderBad(): TemplateResult {
return html`<p class="pb-aggregate-card">
return html`<p class="ak-aggregate-card">
<i class="fa fa-exclamation-triangle"></i> ${this.value}
</p>
<p class="subtext">${this.warningText ? gettext(this.warningText) : ""}</p>`;
@ -49,7 +49,7 @@ export class AdminStatusCard extends AggregatePromiseCard {
}
@customElement("pb-admin-overview")
@customElement("ak-admin-overview")
export class AdminOverviewPage extends LitElement {
@property({attribute: false})
data?: AdminOverview;
@ -74,45 +74,54 @@ export class AdminOverviewPage extends LitElement {
</section>
<section class="pf-c-page__main-section">
<div class="pf-l-gallery pf-m-gutter">
<pb-aggregate-card class="pf-l-gallery__item pf-m-4-col" icon="pf-icon pf-icon-server" header="Logins over the last 24 hours" style="grid-column-end: span 3;grid-row-end: span 2;">
<pb-admin-logins-chart url="${DefaultClient.makeUrl(["admin", "metrics"])}"></pb-admin-logins-chart>
</pb-aggregate-card>
<pb-aggregate-card class="pf-l-gallery__item pf-m-4-col" icon="pf-icon pf-icon-server" header="Apps with most usage" style="grid-column-end: span 2;grid-row-end: span 3;">
<pb-top-applications-table></pb-top-applications-table>
</pb-aggregate-card>
<pb-aggregate-card class="pf-l-gallery__item pf-m-4-col" icon="pf-icon pf-icon-server" header="Workers">
</pb-aggregate-card>
<pb-aggregate-card class="pf-l-gallery__item pf-m-4-col" icon="pf-icon pf-icon-plugged" header="Providers" headerLink="#/administration/providers/">
<ak-aggregate-card class="pf-l-gallery__item pf-m-4-col" icon="pf-icon pf-icon-server" header="Logins over the last 24 hours" style="grid-column-end: span 3;grid-row-end: span 2;">
<ak-admin-logins-chart url="${DefaultClient.makeUrl(["admin", "metrics"])}"></ak-admin-logins-chart>
</ak-aggregate-card>
<ak-aggregate-card class="pf-l-gallery__item pf-m-4-col" icon="pf-icon pf-icon-server" header="Apps with most usage" style="grid-column-end: span 2;grid-row-end: span 3;">
<ak-top-applications-table></ak-top-applications-table>
</ak-aggregate-card>
<ak-aggregate-card class="pf-l-gallery__item pf-m-4-col" icon="pf-icon pf-icon-server" header="Workers">
${this.data ?
this.data?.worker_count < 1 ?
html`<p class="ak-aggregate-card">
<i class="fa fa-exclamation-triangle"></i> ${this.data?.worker_count}
</p>
<p class="subtext">${gettext("No workers connected.")}</p>` :
html`<p class="ak-aggregate-card">
<i class="fa fa-check-circle"></i> ${this.data?.worker_count}
</p>`
: html`<ak-spinner size=${SpinnerSize.Large}></ak-spinner>`}
</ak-aggregate-card>
<ak-aggregate-card class="pf-l-gallery__item pf-m-4-col" icon="pf-icon pf-icon-plugged" header="Providers" headerLink="#/administration/providers/">
${this.data ?
this.data?.providers_without_application > 1 ?
html`<p class="pb-aggregate-card">
html`<p class="ak-aggregate-card">
<i class="fa fa-exclamation-triangle"></i> 0
</p>
<p class="subtext">${gettext("At least one Provider has no application assigned.")}</p>` :
html`<p class="pb-aggregate-card">
html`<p class="ak-aggregate-card">
<i class="fa fa-check-circle"></i> 0
</p>`
: html`<pb-spinner size=${SpinnerSize.Large}></pb-spinner>`}
</pb-aggregate-card>
<pb-aggregate-card class="pf-l-gallery__item pf-m-4-col" icon="pf-icon pf-icon-plugged" header="Policies" headerLink="#/administration/policies/">
: html`<ak-spinner size=${SpinnerSize.Large}></ak-spinner>`}
</ak-aggregate-card>
<ak-aggregate-card class="pf-l-gallery__item pf-m-4-col" icon="pf-icon pf-icon-plugged" header="Policies" headerLink="#/administration/policies/">
${this.data ?
this.data?.policies_without_binding > 1 ?
html`<p class="pb-aggregate-card">
html`<p class="ak-aggregate-card">
<i class="fa fa-exclamation-triangle"></i> 0
</p>
<p class="subtext">${gettext("Policies without binding exist.")}</p>` :
html`<p class="pb-aggregate-card">
html`<p class="ak-aggregate-card">
<i class="fa fa-check-circle"></i> 0
</p>`
: html`<pb-spinner size=${SpinnerSize.Large}></pb-spinner>`}
</pb-aggregate-card>
<pb-aggregate-card-promise
: html`<ak-spinner size=${SpinnerSize.Large}></ak-spinner>`}
</ak-aggregate-card>
<ak-aggregate-card-promise
icon="pf-icon pf-icon-user"
header="Users"
headerLink="#/administration/users/"
.promise=${this.users}>
</pb-aggregate-card-promise>
</ak-aggregate-card-promise>
</div>
</section>`;
}

View File

@ -5,7 +5,7 @@ import { COMMON_STYLES } from "../../common/styles";
import "../../elements/Spinner";
@customElement("pb-top-applications-table")
@customElement("ak-top-applications-table")
export class TopApplicationsTable extends LitElement {
@property({attribute: false})
@ -43,7 +43,7 @@ export class TopApplicationsTable extends LitElement {
</tr>
</thead>
<tbody role="rowgroup">
${this.topN ? this.topN.map((e) => this.renderRow(e)) : html`<pb-spinner></pb-spinner>`}
${this.topN ? this.topN.map((e) => this.renderRow(e)) : html`<ak-spinner></ak-spinner>`}
</tbody>
</table>`;
}

View File

@ -4,13 +4,13 @@ import { Application } from "../../api/application";
import { PBResponse } from "../../api/client";
import { TablePage } from "../../elements/table/TablePage";
@customElement("pb-application-list")
@customElement("ak-application-list")
export class ApplicationList extends TablePage<Application> {
pageTitle(): string {
return gettext("Applications");
}
pageDescription(): string {
return gettext("External Applications which use passbook as Identity-Provider, utilizing protocols like OAuth2 and SAML.");
return gettext("External Applications which use authentik as Identity-Provider, utilizing protocols like OAuth2 and SAML.");
}
pageIcon(): string {
return gettext("pf-icon pf-icon-applications");
@ -34,18 +34,18 @@ export class ApplicationList extends TablePage<Application> {
item.provider.toString(),
item.provider.toString(),
`
<pb-modal-button href="administration/policies/bindings/${item.pk}/update/">
<pb-spinner-button slot="trigger" class="pf-m-secondary">
<ak-modal-button href="administration/policies/bindings/${item.pk}/update/">
<ak-spinner-button slot="trigger" class="pf-m-secondary">
Edit
</pb-spinner-button>
</ak-spinner-button>
<div slot="modal"></div>
</pb-modal-button>
<pb-modal-button href="administration/policies/bindings/${item.pk}/delete/">
<pb-spinner-button slot="trigger" class="pf-m-danger">
</ak-modal-button>
<ak-modal-button href="administration/policies/bindings/${item.pk}/delete/">
<ak-spinner-button slot="trigger" class="pf-m-danger">
Delete
</pb-spinner-button>
</ak-spinner-button>
<div slot="modal"></div>
</pb-modal-button>
</ak-modal-button>
`,
];
}

View File

@ -9,7 +9,7 @@ import { Table } from "../../elements/table/Table";
import "../../elements/Tabs";
import "../../elements/AdminLoginsChart";
@customElement("pb-bound-policies-list")
@customElement("ak-bound-policies-list")
export class BoundPoliciesList extends Table<PolicyBinding> {
@property()
target?: string;
@ -33,24 +33,24 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
item.order.toString(),
item.timeout.toString(),
`
<pb-modal-button href="administration/policies/bindings/${item.pk}/update/">
<pb-spinner-button slot="trigger" class="pf-m-secondary">
<ak-modal-button href="administration/policies/bindings/${item.pk}/update/">
<ak-spinner-button slot="trigger" class="pf-m-secondary">
Edit
</pb-spinner-button>
</ak-spinner-button>
<div slot="modal"></div>
</pb-modal-button>
<pb-modal-button href="administration/policies/bindings/${item.pk}/delete/">
<pb-spinner-button slot="trigger" class="pf-m-danger">
</ak-modal-button>
<ak-modal-button href="administration/policies/bindings/${item.pk}/delete/">
<ak-spinner-button slot="trigger" class="pf-m-danger">
Delete
</pb-spinner-button>
</ak-spinner-button>
<div slot="modal"></div>
</pb-modal-button>
</ak-modal-button>
`,
];
}
}
@customElement("pb-application-view")
@customElement("ak-application-view")
export class ApplicationViewPage extends LitElement {
@property()
set args(value: { [key: string]: string }) {
@ -88,8 +88,8 @@ export class ApplicationViewPage extends LitElement {
<p>${this.application?.meta_publisher}</p>
</div>
</section>
<pb-tabs>
<section slot="page-1" tab-title="Users" class="pf-c-page__main-section pf-m-no-padding-mobile">
<ak-tabs>
<section slot="page-1" data-tab-title="Users" class="pf-c-page__main-section pf-m-no-padding-mobile">
<div class="pf-l-gallery pf-m-gutter">
<div class="pf-c-card pf-c-card-aggregate pf-l-gallery__item pf-m-4-col" style="grid-column-end: span 3;grid-row-end: span 2;">
<div class="pf-c-card__header">
@ -99,18 +99,18 @@ export class ApplicationViewPage extends LitElement {
</div>
<div class="pf-c-card__body">
${this.application ? html`
<pb-admin-logins-chart
<ak-admin-logins-chart
url="${DefaultClient.makeUrl(["core", "applications", this.application?.slug, "metrics"])}">
</pb-admin-logins-chart>`: ""}
</ak-admin-logins-chart>`: ""}
</div>
</div>
</div>
</section>
<div slot="page-2" tab-title="Policy Bindings" class="pf-c-page__main-section pf-m-no-padding-mobile">
<div slot="page-2" data-tab-title="Policy Bindings" class="pf-c-page__main-section pf-m-no-padding-mobile">
<div class="pf-c-card">
<pb-bound-policies-list .target=${this.application.pk}></pb-bound-policies-list>
<ak-bound-policies-list .target=${this.application.pk}></ak-bound-policies-list>
</div>
</div>
</pb-tabs>`;
</ak-tabs>`;
}
}

View File

@ -11,7 +11,7 @@ interface Response {
body?: string;
}
@customElement("pb-flow-shell-card")
@customElement("ak-flow-shell-card")
export class FlowShellCard extends LitElement {
@property()
flowBodyUrl = "";
@ -59,7 +59,7 @@ export class FlowShellCard extends LitElement {
this.setFormSubmitHandlers();
break;
default:
console.debug(`passbook/flows: unexpected data type ${data.type}`);
console.debug(`authentik/flows: unexpected data type ${data.type}`);
break;
}
}
@ -84,13 +84,13 @@ export class FlowShellCard extends LitElement {
const element = <HTMLInputElement>form.elements[index];
if (element.value === form.action) {
console.debug(
"passbook/flows: Found Form action URL in form elements, not changing form action."
"authentik/flows: Found Form action URL in form elements, not changing form action."
);
return false;
}
}
form.action = this.flowBodyUrl;
console.debug(`passbook/flows: updated form.action ${this.flowBodyUrl}`);
console.debug(`authentik/flows: updated form.action ${this.flowBodyUrl}`);
return true;
}
@ -102,11 +102,11 @@ export class FlowShellCard extends LitElement {
setFormSubmitHandlers(): void {
this.querySelectorAll("form").forEach((form) => {
console.debug(`passbook/flows: Checking for autosubmit attribute ${form}`);
console.debug(`authentik/flows: Checking for autosubmit attribute ${form}`);
this.checkAutosubmit(form);
console.debug(`passbook/flows: Setting action for form ${form}`);
console.debug(`authentik/flows: Setting action for form ${form}`);
this.updateFormAction(form);
console.debug(`passbook/flows: Adding handler for form ${form}`);
console.debug(`authentik/flows: Adding handler for form ${form}`);
form.addEventListener("submit", (e) => {
e.preventDefault();
const formData = new FormData(form);
@ -125,14 +125,14 @@ export class FlowShellCard extends LitElement {
this.errorMessage(e);
});
});
form.classList.add("pb-flow-wrapped");
form.classList.add("ak-flow-wrapped");
});
}
errorMessage(error: string): void {
this.flowBody = `
<style>
.pb-exception {
.ak-exception {
font-family: monospace;
overflow-x: scroll;
}
@ -146,12 +146,12 @@ export class FlowShellCard extends LitElement {
<h3>
Something went wrong! Please try again later.
</h3>
<pre class="pb-exception">${error}</pre>
<pre class="ak-exception">${error}</pre>
</div>`;
}
loading(): TemplateResult {
return html` <div class="pf-c-login__main-body pb-loading">
return html` <div class="pf-c-login__main-body ak-loading">
<span class="pf-c-spinner" role="progressbar" aria-valuetext="Loading...">
<span class="pf-c-spinner__clipper"></span>
<span class="pf-c-spinner__lead-ball"></span>

View File

@ -7,7 +7,7 @@ import SpinnerStyle from "@patternfly/patternfly/components/Spinner/spinner.css"
import BackdropStyle from "@patternfly/patternfly/components/Backdrop/backdrop.css";
import { SpinnerSize } from "../../elements/Spinner";
@customElement("pb-site-shell")
@customElement("ak-site-shell")
export class SiteShell extends LitElement {
@property()
set url(value: string) {
@ -45,6 +45,13 @@ export class SiteShell extends LitElement {
];
}
constructor() {
super();
this.addEventListener("ak-refresh", () => {
this.loadContent();
});
}
loadContent(): void {
if (!this._url) {
return;
@ -55,7 +62,7 @@ export class SiteShell extends LitElement {
if (r.ok) {
return r;
}
console.debug(`passbook/site-shell: Request failed ${this._url}`);
console.debug(`authentik/site-shell: Request failed ${this._url}`);
window.location.hash = "#/";
throw new Error("Request failed");
})
@ -69,7 +76,7 @@ export class SiteShell extends LitElement {
})
.then(() => {
// Ensure anchors only change the hash
this.querySelectorAll<HTMLAnchorElement>("a:not(.pb-root-link)").forEach((a) => {
this.querySelectorAll<HTMLAnchorElement>("a:not(.ak-root-link)").forEach((a) => {
if (a.href === "") {
return;
}
@ -78,12 +85,12 @@ export class SiteShell extends LitElement {
const qs = url.search || "";
a.href = `#${url.pathname}${qs}`;
} catch (e) {
console.debug(`passbook/site-shell: error ${e}`);
console.debug(`authentik/site-shell: error ${e}`);
a.href = `#${a.href}`;
}
});
// Create refresh buttons
this.querySelectorAll("[role=pb-refresh]").forEach((rt) => {
this.querySelectorAll("[role=ak-refresh]").forEach((rt) => {
rt.addEventListener("click", () => {
this.loadContent();
});
@ -108,7 +115,7 @@ export class SiteShell extends LitElement {
html`<div class="pf-c-backdrop">
<div class="pf-l-bullseye">
<div class="pf-l-bullseye__item">
<pb-spinner size=${SpinnerSize.Large}></pb-spinner>
<ak-spinner size=${SpinnerSize.Large}></ak-spinner>
</div>
</div>
</div>`

View File

@ -15,7 +15,7 @@ export class Route {
redirect(to: string): Route {
this.callback = () => {
console.debug(`passbook/router: redirecting ${to}`);
console.debug(`authentik/router: redirecting ${to}`);
window.location.hash = `#${to}`;
return html``;
};

View File

@ -11,7 +11,7 @@ import { RouteMatch } from "./RouteMatch";
import "../generic/SiteShell";
@customElement("pb-router-outlet")
@customElement("ak-router-outlet")
export class RouterOutlet extends LitElement {
@property({attribute: false})
current?: RouteMatch;
@ -46,28 +46,28 @@ export class RouterOutlet extends LitElement {
if (activeUrl === "") {
activeUrl = this.defaultUrl || "/";
window.location.hash = `#${activeUrl}`;
console.debug(`passbook/router: set to ${window.location.hash}`);
console.debug(`authentik/router: set to ${window.location.hash}`);
return;
}
let matchedRoute: RouteMatch | null = null;
ROUTES.some((route) => {
console.debug(`passbook/router: matching ${activeUrl} against ${route.url}`);
console.debug(`authentik/router: matching ${activeUrl} against ${route.url}`);
const match = route.url.exec(activeUrl);
if (match != null) {
matchedRoute = new RouteMatch(route);
matchedRoute.arguments = match.groups || {};
matchedRoute.fullUrl = activeUrl;
console.debug(`passbook/router: found match ${matchedRoute}`);
console.debug(`authentik/router: found match ${matchedRoute}`);
return true;
}
});
if (!matchedRoute) {
console.debug(`passbook/router: route "${activeUrl}" not defined, defaulting to shell`);
console.debug(`authentik/router: route "${activeUrl}" not defined, defaulting to shell`);
const route = new Route(
RegExp(""),
html`<pb-site-shell url=${activeUrl}>
html`<ak-site-shell url=${activeUrl}>
<div slot="body"></div>
</pb-site-shell>`
</ak-site-shell>`
);
matchedRoute = new RouteMatch(route);
matchedRoute.arguments = route.url.exec(activeUrl)?.groups || {};