authentik fork
This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
Ken Sternberg 38272e8a68
web: refactor the table renderer for legibility (#7433)
* web: break circular dependency between AKElement & Interface.

This commit changes the way the root node of the web application shell is
discovered by child components, such that the base class shared by both
no longer results in a circular dependency between the two models.

I've run this in isolation and have seen no failures of discovery; the identity
token exists as soon as the Interface is constructed and is found by every item
on the page.

* web: fix broken typescript references

This built... and then it didn't?  Anyway, the current fix is to
provide type information the AkInterface for the data that consumers
require.

* Refactor the Table component for legiibility.

This commit does not change the functionality of the Table, nor does it require any changes to
existing uses of the Table.

It will probably be easier to review this by looking at the `View Code` in the upper-right-hand
corner of GitHub's reviewer; that or side-by-side, if your monitor is wide-enough.

The existing Table component is used 49 times (at last count) in authentik, and those uses are
wide-ranging and complex, but they all come down to a couple of entries:

- Displaying a row of summary information
- Permitting the display of more complex ("expanded") information
- Displaying a collection of rows
- Displaying a collection of rows grouped by some header
- Pagination of many rows
- Permitting an action on the visible rows
- *Not* blocking events that may happen on a cell or expansion
- Providing a toolbar
- Providing a display of "selected items" when using the table as a multi-select with many pages of
  items (chips display)
- Providing sort functionality on columns
- Providing the ability to filter the table from the back-end

This commit changes none of that.

What this commit does is re-arrange the innards of Table.ts into smaller units:

- The RowGroup's "checkbox" and "expansion" segments are pulled out into their own functions, which
  makes the RowGroup's actual functionality much easier to see and understand.  The same is true of
  the rowGroup's selection and expansion handlers.
- Almost all in-line decisions and event handlers have been extracted and named, to make it easier
  to see and understand what's happening inside what is otherwise a jumble of HTML.
- The TablePagination code was duplicated-- and one of the duplicates was wrong!  So I've
  deduplicated it and fixed the bug.
- In many cases, the conditional code grew organically, resulting in some pretty hard-to-understand
  conditions.
  - A really good example is the `itemSelectHandler`; there are two possible events that result in a
    change, and the consequences of that change may be that *all* checkboxes are unchecked. In all
    cases where there's an add/remove option, I've opted to remove the specific object always (even
    if it's not present!), and then add it if it's actually an add.  Logically coherent as long as
    the accessors are not also mutators.

It was not possible to redefine the `columns()` function to take anything other than a TableColumn
object; I wanted to be able to replace all of the `new TableColumn("Foo")` with just `"Foo"`,
building the TableColumn dynamically at construction time. Unfortunately, some of our most complex
tables dynamically re-arrange the columns (RBAC, for example, draws an empty table, fetches the
content, then redraws with the columns based on what was retrieved), and detecting that change and
rebuilding those columns proved more difficult than anticipated.  I may contemplate an alternative
column specification if I find myself building a lot of tables.

Likewise, it was not possible to replace all of our uses of the empty `html` declaration with the
Lit-preferred `nothing` sigil; hard-coded `TemplateResult` entries scattered throughout the code
caused massive type inconsistencies, since a type of `TemplateResult | nothing` is unique thanks to
`nothing`'s underlying Symbol. It is for this issue that Typescript itself recommends you "prefer
allowing Typescript infer the return type." I may revisit this issue later.

I've added a `prequick` command to `package.json`; this one runs *only* the Typescript type checker,
lit-analyse, and `eslint:precommit`, the last of which lints only the files touched since the last
commit. This is fast, intended to support quick checks of code quality not normally displayed in the
IDE.

* web: refactor table

After talking to Jens, I've put back the positional variable and eslint escape; it's better
to document existing practices than try to force something.

I also misunderstood the role of `inner` in one bit of code, and have restored its functionality.
Looking through the code, though, I can see a case where it will fail; it's expecting `inner` to
be either undefined or a TemplateResult; if there's no error message, the error message defaults
to a blank TemplateResult, which is _not_ undefined, and will result in a blank table.

This will only happen under very weird network failures, but...
2023-12-12 12:04:39 +01:00
.github ci: bump actions/stale from 8 to 9 (#7815) 2023-12-08 15:29:39 +02:00
.vscode core: fix sources get icon naming (#7674) 2023-11-21 21:38:30 +01:00
authentik web/flows: show logo in card (#7824) 2023-12-08 20:34:35 +02:00
blueprints stages/identification: add option to pretend user exists (#7610) 2023-11-18 01:55:48 +01:00
cmd web/flows: bottom-align about text on flows page (#7051) 2023-10-03 14:10:10 +02:00
internal outposts/ldap: avoid nil ptr deref in MemorySearcher (#7767) 2023-12-04 20:32:33 +02:00
lifecycle scripts: postgres, redis: only listen on localhost (#7849) 2023-12-11 11:08:48 +00:00
locale translate: Updates for file locale/en/LC_MESSAGES/django.po in fr (#7850) 2023-12-11 10:35:19 +00:00
schemas providers: SCIM (#4835) 2023-03-06 19:39:08 +01:00
scripts scripts: postgres, redis: only listen on localhost (#7849) 2023-12-11 11:08:48 +00:00
tests web: bump ts-node from 10.9.1 to 10.9.2 in /tests/wdio (#7846) 2023-12-11 11:54:14 +01:00
web web: refactor the table renderer for legibility (#7433) 2023-12-12 12:04:39 +01:00
website documentation: Improve explanation of kubernetes_json_patches (#7832) 2023-12-12 00:24:35 +00:00
.bumpversion.cfg release: 2023.10.4 2023-11-21 19:29:02 +01:00
.dockerignore root: don't exclude enterprise from container image (#6956) 2023-09-22 16:22:16 +02:00
.editorconfig website: codespell with custom dictionary and CI (#5062) 2023-03-24 00:24:55 +01:00
.gitignore root: Ignore the vendor folder (#7094) 2023-10-06 17:50:46 +02:00
CODE_OF_CONDUCT.md root: rework and expand security policy 2022-11-28 12:10:53 +01:00
CODEOWNERS web: bump the eslint group in /web with 1 update (#7039) 2023-10-02 19:37:32 +02:00
CONTRIBUTING.md website/developer-docs: move contributing to dev docs index and link contributing file (#5554) 2023-05-09 20:26:55 +02:00
docker-compose.yml release: 2023.10.4 2023-11-21 19:29:02 +01:00
Dockerfile core: bump python from 3.12.0-slim-bookworm to 3.12.1-slim-bookworm 2023-12-11 08:04:48 +01:00
go.mod core: bump github.com/go-openapi/runtime from 0.26.0 to 0.26.2 (#7841) 2023-12-11 11:54:00 +01:00
go.sum core: bump github.com/go-openapi/runtime from 0.26.0 to 0.26.2 (#7841) 2023-12-11 11:54:00 +01:00
ldap.Dockerfile Fix cache related image build issues 2023-12-09 06:07:21 +01:00
LICENSE enterprise: initial license (#5293) 2023-04-19 16:13:45 +02:00
Makefile website: bump the docusaurus group in /website with 3 updates (#7400) 2023-11-06 15:12:23 +01:00
manage.py root: update deprecation warnings 2022-11-25 11:47:28 +01:00
poetry.lock core: bump python from 3.11.5-bookworm to 3.12.0-bookworm (#7048) 2023-11-22 12:52:17 +01:00
proxy.Dockerfile Fix cache related image build issues 2023-12-09 06:07:21 +01:00
pyproject.toml core: bump python from 3.11.5-bookworm to 3.12.0-bookworm (#7048) 2023-11-22 12:52:17 +01:00
radius.Dockerfile Fix cache related image build issues 2023-12-09 06:07:21 +01:00
README.md root: remove outdated sponsorship section on readme (#6973) 2023-09-25 16:38:50 +02:00
schema.yml events: add graph for event volume (#7639) 2023-12-06 19:06:07 +02:00
SECURITY.md root: update security policy to include link to cure53 report (#7853) 2023-12-11 15:26:36 -06:00

authentik logo


Join Discord GitHub Workflow Status GitHub Workflow Status GitHub Workflow Status Code Coverage Docker pulls Latest version

What is authentik?

authentik is an open-source Identity Provider that emphasizes flexibility and versatility. It can be seamlessly integrated into existing environments to support new protocols. authentik is also a great solution for implementing sign-up, recovery, and other similar features in your application, saving you the hassle of dealing with them.

Installation

For small/test setups it is recommended to use Docker Compose; refer to the documentation.

For bigger setups, there is a Helm Chart here. This is documented here.

Screenshots

Light Dark

Development

See Developer Documentation

Security

See SECURITY.md

Adoption and Contributions

Your organization uses authentik? We'd love to add your logo to the readme and our website! Email us @ hello@goauthentik.io or open a GitHub Issue/PR! For more information on how to contribute to authentik, please refer to our CONTRIBUTING.md file.