Support toml config and config social auth#3889
Conversation
Test results 7 files 7 suites 13m 28s ⏱️ Results for commit 240a4c2. ♻️ This comment has been updated with latest results. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3889 +/- ##
==========================================
+ Coverage 63.83% 64.13% +0.29%
==========================================
Files 624 625 +1
Lines 46174 46530 +356
Branches 43 43
==========================================
+ Hits 29476 29840 +364
+ Misses 16688 16680 -8
Partials 10 10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
873f30b to
a45eb50
Compare
That may be built-in to Python's |
If we, at some point, want to migrate existing config files from |
Sounds like a future problem. There is one feature missing: SAML-support (out of scope, will take some effort), and there should probably be docs. |
|
The provider "openid" need extra models (tables!) That seems to be the only one among the ones bundled with allauth. |
lunkwill42
left a comment
There was a problem hiding this comment.
I find this PR a bit hard to follow at first - I wanted to play around with it, but we should probably get my questions out of the way first :)
|
I'm thinking |
|
Warning 5 of 12 new test names are missing convention keywords (
Why am I seeing this?Test names should follow a loose given/when/then pattern with keywords like Examples:
|
e599b23 to
bb30661
Compare
eb11aac to
a1c2901
Compare
lunkwill42
left a comment
There was a problem hiding this comment.
The functionality works for me now; I am able to configure both MFA and OIDC for Feide quite easily.
However, I found the tests are broken. In fact, all the test files in the tests/unittests/web/auth/ (including the pre-existing ones) are named incorrectly, so they are not collected by a full test run, only if run explicitly as arguments to pytest.
Test files should end in _test.py, not _tests.py (or they should start with test_).
|
Added #3944 to fix the pre-existing test files |
|
Pushed fixups for the incorrectly named test file, and also for fixing the failing tests in it. |
|
Since @hmpf is busy with other things, I've fixed all my issues and nitpicks and pushed fixups myself. |
Use the `test_when_<condition>_then_<subject>_should_<assertion>` pattern to match the project's test naming standard.
The passkey/webauthn feature doesn't work end-to-end yet: `MFAConfigParser.get_MFA_SUPPORTED_TYPES_setting()` appends `"passkeys"` to the list, but allauth expects `"webauthn"`, and the webauthn URLs, views, and templates are never activated. Remove user-facing references to avoid confusion. The config parser plumbing can stay for future use.
ee43df4 to
3f86990
Compare
|



Scope and purpose
Fixes #3814
Depends on #3924
Setting up social providers (like saml, oidc, github, google, facebook..) with NAV-config isn't supported very well with today's nav config infrastructure, so here's an attempt at using toml instead.
The new TOMLConfigParser-class does not support everything the old class does. It does not support writing out toml-files, because we'd need an additional library for that if we don't want to roll our own.
It does not support multiple files per config section, as I couldn't find that this feature was used anywhere in the existing code.
It does support predefining a default-config section, and we need that for any None-value since toml does not support None as a value on principle. We can have 'em in default config anyway.
This pull request
tomli, so that tests pass on Python < 3.11
How to test
This involves a new config file, "/etc/nav/webfront/authentication.toml". Make sure a copy is in the right location when testing. If using "docker compose" it might be easiest to copy the new file manually to the correct location, the container "config" should always be up and running.
It is necessary to have a client id and secret from "some" provider for a full manual test.
Contributor Checklist
Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to NAV can be found in the
Hacker's guide to NAV.
<major>.<minor>.x). For a new feature or other additions, it should be based onmaster.