From ccd4665d821cbe3a11092f6b48da4174e2005ae1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Mar 2021 09:13:14 +0100 Subject: [PATCH 1/6] build(deps): bump rollup from 2.42.3 to 2.42.4 in /web (#661) Bumps [rollup](https://github.com/rollup/rollup) from 2.42.3 to 2.42.4. - [Release notes](https://github.com/rollup/rollup/releases) - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md) - [Commits](https://github.com/rollup/rollup/compare/v2.42.3...v2.42.4) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- web/package-lock.json | 6 +++--- web/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/package-lock.json b/web/package-lock.json index e49a55ba7..2033240b7 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -2817,9 +2817,9 @@ } }, "rollup": { - "version": "2.42.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.42.3.tgz", - "integrity": "sha512-JjaT9WaUS5vmjy6xUrnPOskjkQg2cN4WSACNCwbOvBz8VDmbiKVdmTFUoMPRqTud0tsex8Xy9/boLbDW9HKD1w==", + "version": "2.42.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.42.4.tgz", + "integrity": "sha512-Zqv3EvNfcllBHyyEUM754npqsZw82VIjK34cDQMwrQ1d6aqxzeYu5yFb7smGkPU4C1Bj7HupIMeT6WU7uIdnMw==", "requires": { "fsevents": "~2.3.1" } diff --git a/web/package.json b/web/package.json index b5757b497..e1106ca38 100644 --- a/web/package.json +++ b/web/package.json @@ -26,7 +26,7 @@ "lit-element": "^2.4.0", "lit-html": "^1.3.0", "rapidoc": "^8.4.9", - "rollup": "^2.42.3", + "rollup": "^2.42.4", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-cssimport": "^1.0.2", "rollup-plugin-external-globals": "^0.6.1", From e7fd37efeb1eb195df491f4f649a7897544d76c0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Mar 2021 09:13:24 +0100 Subject: [PATCH 2/6] build(deps): bump boto3 from 1.17.35 to 1.17.36 (#660) Bumps [boto3](https://github.com/boto/boto3) from 1.17.35 to 1.17.36. - [Release notes](https://github.com/boto/boto3/releases) - [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst) - [Commits](https://github.com/boto/boto3/compare/1.17.35...1.17.36) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Pipfile.lock | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index 26c056c75..3b2063505 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -116,18 +116,18 @@ }, "boto3": { "hashes": [ - "sha256:1e6e06b2f1eee5a76acdde1e7b4f57c93c1bf2905341207d74f2a140ce060cd8", - "sha256:40e84a5f7888924db74a2710dbe48d066b51fe1f5549efaffe90e6efe813f37b" + "sha256:16ca7a34eb88138e0d1ae2532e17975eef578aa1754e2d209ad41a8dfce059ce", + "sha256:75f59fb3d764a381bb0108cb5036b398d0c8a1cf719e6b5aadbc5a53a1fd735e" ], "index": "pypi", - "version": "==1.17.35" + "version": "==1.17.36" }, "botocore": { "hashes": [ - "sha256:9119ffb231145ffadd55391c9356dcdb18e3de65c3a7c82844634e949f0ca5a0", - "sha256:e34bbb7d7de154c2ff2a73ae0691c601a69c5bda887374c8a6a23072380b07a4" + "sha256:148f5d7d48c54ed450831e5dd4d13284b2418955b6d99db23a3d9c4c6cb515c8", + "sha256:9ce33bd4175d58c5fdeb8e35052aa370aff74b347227e65ddc3f4fa01ef0686f" ], - "version": "==1.20.35" + "version": "==1.20.36" }, "cachetools": { "hashes": [ @@ -621,6 +621,7 @@ "sha256:542d454665a3e277f76954418124d67516c5f88e51a900365ed54a9806122b83", "sha256:5a0a14e264069c03e46f926be0d8919f4105c1623d620e7ec0e612a2e9bf1c04", "sha256:66e575c62792c3f9ca47cb8b6fab9e35bab91360c783d1606f758761810c9791", + "sha256:74f7d8d439b18fa4c385f3f5dfd11144bb87c1da034a466c5b5577d23a1d9b51", "sha256:7610b8c31688f0b1be0ef882889817939490a36d0ee880ea562a4e1399c447a1", "sha256:76fa7b1362d19f8fbd3e75fe2fb7c79359b0af8747e6f7141c338f0bee2f871a", "sha256:7728e05c35412ba36d3e9795ae8995e3c86958179c9770e65558ec3fdfd3724f", @@ -639,7 +640,8 @@ "sha256:efac139c3f0bf4f0939f9375af4b02c5ad83a622de52d6dfa8e438e8e01d0eb0", "sha256:efd7a09678fd8b53117f6bae4fa3825e0a22b03ef0a932e070c0bdbb3a35e654", "sha256:f2380a6376dfa090227b663f9678150ef27543483055cc327555fb592c5967e2", - "sha256:f8380c03e45cf09f8557bdaa41e1fa7c81f3ae22828e1db470ab2a6c96d8bc23" + "sha256:f8380c03e45cf09f8557bdaa41e1fa7c81f3ae22828e1db470ab2a6c96d8bc23", + "sha256:f90ba11136bfdd25cae3951af8da2e95121c9b9b93727b1b896e3fa105b2f586" ], "index": "pypi", "version": "==4.6.3" From ec8dee35888d4a7f6a0569991bc7b37d289d9696 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 24 Mar 2021 21:16:03 +0100 Subject: [PATCH 3/6] web: add API Drawer Signed-off-by: Jens Langhammer --- web/src/api/Config.ts | 6 +- web/src/constants.ts | 1 + web/src/elements/notifications/APIDrawer.ts | 86 +++++++++++++++++++++ 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 web/src/elements/notifications/APIDrawer.ts diff --git a/web/src/api/Config.ts b/web/src/api/Config.ts index fbb388c43..10a96aa27 100644 --- a/web/src/api/Config.ts +++ b/web/src/api/Config.ts @@ -4,13 +4,17 @@ import { VERSION } from "../constants"; import { SentryIgnoredError } from "../common/errors"; import { Config, Configuration, RootApi } from "authentik-api"; import { getCookie } from "../utils"; +import { MIDDLEWARE } from "../elements/notifications/APIDrawer"; export const DEFAULT_CONFIG = new Configuration({ basePath: "/api/v2beta", headers: { "X-CSRFToken": getCookie("authentik_csrf"), "X-Authentik-Prevent-Basic": "true" - } + }, + middleware: [ + MIDDLEWARE + ], }); export function configureSentry(): Promise { diff --git a/web/src/constants.ts b/web/src/constants.ts index a2a8f1429..04f480d9c 100644 --- a/web/src/constants.ts +++ b/web/src/constants.ts @@ -8,3 +8,4 @@ export const PAGE_SIZE = 20; export const EVENT_REFRESH = "ak-refresh"; export const EVENT_NOTIFICATION_TOGGLE = "ak-notification-toggle"; export const EVENT_SIDEBAR_TOGGLE = "ak-sidebar-toggle"; +export const EVENT_API_DRAWER_REFRESH = "ak-api-drawer-refresh"; diff --git a/web/src/elements/notifications/APIDrawer.ts b/web/src/elements/notifications/APIDrawer.ts new file mode 100644 index 000000000..7134b6dee --- /dev/null +++ b/web/src/elements/notifications/APIDrawer.ts @@ -0,0 +1,86 @@ +import { Middleware, ResponseContext } from "authentik-api"; +import { CSSResult, customElement, html, LitElement, TemplateResult } from "lit-element"; +import PFBase from "@patternfly/patternfly/patternfly-base.css"; +import PFNotificationDrawer from "@patternfly/patternfly/components/NotificationDrawer/notification-drawer.css"; +import PFDropdown from "@patternfly/patternfly/components/Dropdown/dropdown.css"; +import AKGlobal from "../../authentik.css"; +import PFContent from "@patternfly/patternfly/components/Content/content.css"; +import { gettext } from "django"; +import { EVENT_API_DRAWER_REFRESH } from "../../constants"; + +export interface RequestInfo { + method: string; + path: string; +} + +export class APIMiddleware implements Middleware { + requests: RequestInfo[]; + + constructor() { + this.requests = []; + } + + post?(context: ResponseContext): Promise { + this.requests.push({ + method: (context.init.method || "GET").toUpperCase(), + path: context.url, + }); + if (this.requests.length > MAX_REQUESTS) { + this.requests.shift(); + } + window.dispatchEvent( + new CustomEvent(EVENT_API_DRAWER_REFRESH, { + bubbles: true, + composed: true, + }) + ); + return Promise.resolve(context.response); + } +} + +export const MAX_REQUESTS = 50; +export const MIDDLEWARE = new APIMiddleware(); + +@customElement("ak-api-drawer") +export class APIDrawer extends LitElement { + + static get styles(): CSSResult[] { + return [PFBase, PFNotificationDrawer, PFContent, PFDropdown, AKGlobal]; + } + + constructor() { + super(); + this.addEventListener(EVENT_API_DRAWER_REFRESH, () => { + this.requestUpdate(); + }); + } + + renderItem(item: RequestInfo): TemplateResult { + return html`
  • +
    +

    + ${item.method} +

    +
    +

    ${item.path}

    +
  • `; + } + + render(): TemplateResult { + return html`
    +
    +
    +

    + ${gettext("API Requests")} +

    +
    +
    +
      + ${MIDDLEWARE.requests.map(n => this.renderItem(n))} +
    +
    +
    +
    `; + } + +} From fc6f242f86fa5a2727b1b14c39c3eaf569cdde07 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 24 Mar 2021 21:40:08 +0100 Subject: [PATCH 4/6] web/admin/user: fix user source connection lookups Signed-off-by: Jens Langhammer --- authentik/sources/oauth/api/source_connection.py | 2 +- swagger.yaml | 2 +- web/src/pages/users/settings/SourceSettingsOAuth.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/authentik/sources/oauth/api/source_connection.py b/authentik/sources/oauth/api/source_connection.py index bab90cf86..67d34db3b 100644 --- a/authentik/sources/oauth/api/source_connection.py +++ b/authentik/sources/oauth/api/source_connection.py @@ -23,7 +23,7 @@ class UserOAuthSourceConnectionViewSet(ModelViewSet): queryset = UserOAuthSourceConnection.objects.all() serializer_class = UserOAuthSourceConnectionSerializer - filterset_fields = ["source"] + filterset_fields = ["source__slug"] def get_queryset(self): if not self.request: diff --git a/swagger.yaml b/swagger.yaml index 7272898d7..da9fcb68f 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -7415,7 +7415,7 @@ paths: operationId: sources_oauth_user_connections_list description: Source Viewset parameters: - - name: source + - name: source__slug in: query description: '' required: false diff --git a/web/src/pages/users/settings/SourceSettingsOAuth.ts b/web/src/pages/users/settings/SourceSettingsOAuth.ts index 383c1a7f5..94fad46e9 100644 --- a/web/src/pages/users/settings/SourceSettingsOAuth.ts +++ b/web/src/pages/users/settings/SourceSettingsOAuth.ts @@ -26,7 +26,7 @@ export class SourceSettingsOAuth extends BaseUserSettings { renderInner(source: OAuthSource): TemplateResult { return html`${until(new SourcesApi(DEFAULT_CONFIG).sourcesOauthUserConnectionsList({ - source: this.objectId + sourceSlug: this.objectId }).then((connection) => { if (connection.results.length > 0) { return html`

    ${gettext("Connected.")}

    From a39f42974f9c4556b28ece53bb58dbe870dd5b94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Mar 2021 09:39:15 +0100 Subject: [PATCH 5/6] build(deps): bump boto3 from 1.17.36 to 1.17.37 (#662) Bumps [boto3](https://github.com/boto/boto3) from 1.17.36 to 1.17.37. - [Release notes](https://github.com/boto/boto3/releases) - [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst) - [Commits](https://github.com/boto/boto3/compare/1.17.36...1.17.37) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Pipfile.lock | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index 3b2063505..846c16a86 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -116,18 +116,17 @@ }, "boto3": { "hashes": [ - "sha256:16ca7a34eb88138e0d1ae2532e17975eef578aa1754e2d209ad41a8dfce059ce", - "sha256:75f59fb3d764a381bb0108cb5036b398d0c8a1cf719e6b5aadbc5a53a1fd735e" + "sha256:2d1dd1ad3212c389074280c3fc714fd7b038cca259e9b179c58874d0da364de6" ], "index": "pypi", - "version": "==1.17.36" + "version": "==1.17.37" }, "botocore": { "hashes": [ - "sha256:148f5d7d48c54ed450831e5dd4d13284b2418955b6d99db23a3d9c4c6cb515c8", - "sha256:9ce33bd4175d58c5fdeb8e35052aa370aff74b347227e65ddc3f4fa01ef0686f" + "sha256:382d83c0a5b2106c8d0d7a67fb56945197a29cbd0f21625b032ca6941cc4ae31", + "sha256:c78add1ad17646cb952ee67f9f8771a26b269d682edf2708deac7c5d2bc1526d" ], - "version": "==1.20.36" + "version": "==1.20.37" }, "cachetools": { "hashes": [ @@ -272,20 +271,20 @@ }, "cryptography": { "hashes": [ - "sha256:066bc53f052dfeda2f2d7c195cf16fb3e5ff13e1b6b7415b468514b40b381a5b", - "sha256:0923ba600d00718d63a3976f23cab19aef10c1765038945628cd9be047ad0336", - "sha256:2d32223e5b0ee02943f32b19245b61a62db83a882f0e76cc564e1cec60d48f87", - "sha256:4169a27b818de4a1860720108b55a2801f32b6ae79e7f99c00d79f2a2822eeb7", - "sha256:57ad77d32917bc55299b16d3b996ffa42a1c73c6cfa829b14043c561288d2799", - "sha256:5ecf2bcb34d17415e89b546dbb44e73080f747e504273e4d4987630493cded1b", - "sha256:600cf9bfe75e96d965509a4c0b2b183f74a4fa6f5331dcb40fb7b77b7c2484df", - "sha256:66b57a9ca4b3221d51b237094b0303843b914b7d5afd4349970bb26518e350b0", - "sha256:93cfe5b7ff006de13e1e89830810ecbd014791b042cbe5eec253be11ac2b28f3", - "sha256:9e98b452132963678e3ac6c73f7010fe53adf72209a32854d55690acac3f6724", - "sha256:df186fcbf86dc1ce56305becb8434e4b6b7504bc724b71ad7a3239e0c9d14ef2", - "sha256:fec7fb46b10da10d9e1d078d1ff8ed9e05ae14f431fdbd11145edd0550b9a964" + "sha256:0f1212a66329c80d68aeeb39b8a16d54ef57071bf22ff4e521657b27372e327d", + "sha256:1e056c28420c072c5e3cb36e2b23ee55e260cb04eee08f702e0edfec3fb51959", + "sha256:240f5c21aef0b73f40bb9f78d2caff73186700bf1bc6b94285699aff98cc16c6", + "sha256:26965837447f9c82f1855e0bc8bc4fb910240b6e0d16a664bb722df3b5b06873", + "sha256:37340614f8a5d2fb9aeea67fd159bfe4f5f4ed535b1090ce8ec428b2f15a11f2", + "sha256:3d10de8116d25649631977cb37da6cbdd2d6fa0e0281d014a5b7d337255ca713", + "sha256:3d8427734c781ea5f1b41d6589c293089704d4759e34597dce91014ac125aad1", + "sha256:7ec5d3b029f5fa2b179325908b9cd93db28ab7b85bb6c1db56b10e0b54235177", + "sha256:8e56e16617872b0957d1c9742a3f94b43533447fd78321514abbe7db216aa250", + "sha256:de4e5f7f68220d92b7637fc99847475b59154b7a1b3868fb7385337af54ac9ca", + "sha256:eb8cc2afe8b05acbd84a43905832ec78e7b3873fb124ca190f574dca7389a87d", + "sha256:ee77aa129f481be46f8d92a1a7db57269a2f23052d5f2433b4621bb457081cc9" ], - "version": "==3.4.6" + "version": "==3.4.7" }, "dacite": { "hashes": [ @@ -1562,10 +1561,10 @@ }, "gitdb": { "hashes": [ - "sha256:91f36bfb1ab7949b3b40e23736db18231bf7593edada2ba5c3a174a7b23657ac", - "sha256:c9e1f2d0db7ddb9a704c2a0217be31214e91a4fe1dea1efad19ae42ba0c285c9" + "sha256:27dea6c52fbcf768530e1af47f2e34afd24a52e53fa310c8279a5589bd7c85bd", + "sha256:42535bb16b5db8983e2c4f6a714d29a8feba7165a12addc63e08fc672dfeccb9" ], - "version": "==4.0.5" + "version": "==4.0.6" }, "gitpython": { "hashes": [ From 2a437536d4f5b50b1c6528de67f6f98663cc742f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Mar 2021 09:39:51 +0100 Subject: [PATCH 6/6] build(deps): bump djangorestframework from 3.12.2 to 3.12.3 (#663) Bumps [djangorestframework](https://github.com/encode/django-rest-framework) from 3.12.2 to 3.12.3. - [Release notes](https://github.com/encode/django-rest-framework/releases) - [Commits](https://github.com/encode/django-rest-framework/compare/3.12.2...3.12.3) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Pipfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index 846c16a86..efaca1ee6 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -382,11 +382,11 @@ }, "djangorestframework": { "hashes": [ - "sha256:0209bafcb7b5010fdfec784034f059d512256424de2a0f084cb82b096d6dd6a7", - "sha256:0898182b4737a7b584a2c73735d89816343369f259fea932d90dc78e35d8ac33" + "sha256:2fbbd5c28a1aaa1ad0b721b29e916797fc9aba9f9b3e7619da11c674880fc7aa", + "sha256:ef043474687307d4123dc47fecd346594bb98e95b030225ee64bc417578403a7" ], "index": "pypi", - "version": "==3.12.2" + "version": "==3.12.3" }, "djangorestframework-guardian": { "hashes": [