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 55dd7013b4
web: detangle common from elements (#6888)
* Web: Detangling some circular dependencies in Admin and User

Admin, User, and Flow should not dependend upon each other, at least
not in a circular way.  If Admin and User depend on Flow, that's
fine, but Flow should not correspondingly depend upon elements of
either; if they have something in common, let's put them in
`@goauthentik/common` or find some other smart place to store them.

This commit refactors the intentToLabel and actionToLabel functions
into `@goauthentik/common/labels` and converts them to static tables
for maintenance purposes.

* web: "Consistency is the hobgoblin of small minds" - Ralph Waldo Emerson

* web: I found these confusing to look at, so I added comments.

* web: remove admin-to-user component reference(s)

There was only one: AppIcon.  This has been moved to `components`.

Touching the LibraryApplications page triggered a cyclomatic
complexity check.  Extracting the expansion block and streamlining
the class and style declarations with lit directives helped.

* web: remove admin from elements

This commit removes the two references from `elements` to `admin`: the list of UserEvents and a
reference to the FlowSearch type, used by the Forms manager to decide how to extract a value.
For FlowSearch, a different convention for detecting the type was implemented (instances of the
object have a unique fieldname for the value holder).  UserEvents and ObjectChangelog have been
moved to `components` as they're clearly dependent upon the API.

This defers work on removing Admin from Components, as that is (again) references going the
wrong way, but that can happen later.

* web: remove admin-to-user component reference(s) (#6856)

There was only one: AppIcon.  This has been moved to `components`.

Touching the LibraryApplications page triggered a cyclomatic
complexity check.  Extracting the expansion block and streamlining
the class and style declarations with lit directives helped.

* This was supposed to be merged.

* web: remove `./element`⇢`./user` references

The offender here is UserDevicesList, which despite being in `elements` is only
used by the admin/user/UserViewPage.  The problem is that UserDevicesList,
despite being in `admin`, inherits from `user`, so moving it would have created
a new admin⇢user reference, and the whole point of this exercise is to get rid
of references that point "up" from the foundational pieces to the views, or
that refer to components in sibling applications.

After examining UserDevicesList, I realized that *every feature* of MFADevicesList
had been overridden: the rows, the columns, the toolbar, and the endpoint all had
custom overrides.  Nothing was left of MFADevicesList after that.   Even the
property that the web component used had been completely changed.  The only thing
they had in common was that they both inherited from `Table<Device>`.

Refactoring UserDevicesList so that it inherited directly from `Table<Device>` and
then moving it into `./admin/users` was the obvious and correct step.

Both used the same label table, so that went into the `common/labels` folder.

Along the way, I cleaned up a few minor details. Just little things, like the repeated invocation
of:

```
new AuthenticatorsApi(DEFAULT_CONFIG).authenticatorAdminMETHODDestroy({ id: device.pk });
```

This is repeated five times, once for each Method.  By creating these:

```
        const api = new AuthenticatorsApi(DEFAULT_CONFIG);
        const id = { id: device.pk };
```

The method invocation could be just `api.authenticatorsMETHODDestroy(id)`, which is easier on the
eyes.  See the MFADevicesPage for the full example.

Similarly,

```
return [
   new TableColumn(msg("Name"), ""),
   new TableColumn(msg("Type"), ""),
   new TableColumn("")
];
   ```

is more straightforward as:

```
const headers = [msg("Name"), msg("Type"), ""];
return headers.map((th) => new TableColumn(th, ""));
```

We've labeled what we're working with, and web developers ought to know that `th` is the HTML code
for `table header`.

I've had to alter what files are scanned in pre-commit mode; it doesn't handle renamed files very well,
and at the moment a file that is renamed is not scanned, as its "new" name is not straightforwardly
displayed, not even by `git porcelain`.

* web: make the table of column headers look like a table

* web: detangle `common` from `elements`.

And just like that, `common` no longer has a reference to `elements`.   I don't mind this little bit of
code duplication if it removes a cycle.  What it does point out is that there are bits of `common` that
are predicated on the presence of the browser, and that there are bits of `elements` that, if they rely
on `common`, can't be disentangled from the application as a whole.  Which seems to me that we have two
different things going on in common: things about an application, and things about elements that are
independent of the application.

I'll think about those later.

```
$ rg 'import.*@goauthentik' ./common/ | perl -ne 'm{"(@goauthentik[^"]*)"} && print "$1\n"' | sort | cut -d '/' -f1-2 | uniq | sort
@goauthentik/api
@goauthentik/common
$
```

* web: odd bug; merge-related?  Gonna investigate.

* web: build failure thanks to local cache; fixed

* Unwanted change.
2023-09-14 14:14:25 -07:00
.github root: include generated ts client in dev builds 2023-09-13 15:42:23 +02:00
.vscode root: migrate bootstrap to blueprints (#6433) 2023-07-31 19:34:46 +02:00
authentik policies: specify failure result (#6887) 2023-09-14 20:38:22 +02:00
blueprints policies: specify failure result (#6887) 2023-09-14 20:38:22 +02:00
cmd root: connect to backend via socket (#6720) 2023-09-02 17:58:37 +02:00
internal Merge branch 'version-2023.8' 2023-09-11 22:04:23 +02:00
lifecycle fix ak test-all dependencies 2023-09-11 15:44:26 +02:00
locale core: compile backend translations (#6835) 2023-09-11 12:42:19 +02:00
schemas providers: SCIM (#4835) 2023-03-06 19:39:08 +01:00
scripts providers/oauth2: fix id_token being saved incorrectly leading to lost claims (#6645) 2023-08-28 00:51:48 +02:00
tests stages/authenticator: vendor otp (#6741) 2023-09-04 11:45:14 +02:00
web web: detangle common from elements (#6888) 2023-09-14 14:14:25 -07:00
website website/blogs: Blog about closed source vs open source (#6890) 2023-09-14 17:28:47 +00:00
.bumpversion.cfg release: 2023.8.3 2023-09-11 18:55:08 +02:00
.dockerignore root: include generated ts client in dev builds 2023-09-13 15:42:23 +02:00
.editorconfig website: codespell with custom dictionary and CI (#5062) 2023-03-24 00:24:55 +01:00
.gitignore root: add generated Source docs (#5323) 2023-07-31 11:59:20 +02:00
CODE_OF_CONDUCT.md root: rework and expand security policy 2022-11-28 12:10:53 +01:00
CODEOWNERS root: split codeowners (#6884) 2023-09-13 19:44:51 +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.8.3 2023-09-11 18:55:08 +02:00
Dockerfile root: include generated ts client in dev builds 2023-09-13 15:42:23 +02:00
go.mod core: bump github.com/getsentry/sentry-go from 0.24.0 to 0.24.1 (#6894) 2023-09-14 12:01:49 +02:00
go.sum core: bump github.com/getsentry/sentry-go from 0.24.0 to 0.24.1 (#6894) 2023-09-14 12:01:49 +02:00
ldap.Dockerfile mount binds all around 2023-09-11 15:44:26 +02:00
LICENSE enterprise: initial license (#5293) 2023-04-19 16:13:45 +02:00
Makefile root: add docker recipe to Makefile 2023-09-13 15:42:23 +02:00
manage.py root: update deprecation warnings 2022-11-25 11:47:28 +01:00
poetry.lock core: bump sentry-sdk from 1.30.0 to 1.31.0 (#6893) 2023-09-14 12:03:20 +02:00
proxy.Dockerfile mount binds all around 2023-09-11 15:44:26 +02:00
pyproject.toml Merge branch 'version-2023.8' 2023-09-11 22:04:23 +02:00
radius.Dockerfile mount binds all around 2023-09-11 15:44:26 +02:00
README.md web: Add storybook (#5865) 2023-06-07 13:05:33 +02:00
schema.yml policies: specify failure result (#6887) 2023-09-14 20:38:22 +02:00
SECURITY.md website: update 2023.8 release notes (#6666) 2023-08-29 19:57:14 +02: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.

Sponsors

This project is proudly sponsored by:

DigitalOcean provides development and testing resources for authentik.