-
Notifications
You must be signed in to change notification settings - Fork 15
Use django-allauth for MFA and replace python social auth #1406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Test results 4 files 468 suites 17m 37s ⏱️ Results for commit d499b14. ♻️ This comment has been updated with latest results. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1406 +/- ##
==========================================
- Coverage 78.25% 76.33% -1.93%
==========================================
Files 125 138 +13
Lines 5519 5712 +193
==========================================
+ Hits 4319 4360 +41
- Misses 1200 1352 +152 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
In order to use MFA with allauth it is necessary to have a verified email address. The template to verify an address is the same used to add and remove addresses, and to set one of several addresses as "primary". It is not possible to hide the "Add new address"-form since it is also used to change an address, by first adding an address then removing the old. We add addresses via "destinations" and by getting a "synced" address from OAuth2 so we need to adapt somehow. Either copy addresses in destinations to allauth's system or generate destinations from allauth's system or sync both ways. Either way, a "synced" address (copied from social account) cannot be deleted so we cannot leave this form and view untouched. |
|
a5e0285
to
3a5087a
Compare
|
Scope and purpose
django-allauth
(hereafter: allauth) ispython-social-auth
s (hereafter: PSA) oldest competitor. It is possible to replace PSA with allauth, and the latter has support for MFA built in.It is possible to run the two in parallel, there are no clashing module names or table names.
django-allauth does not support LDAP logins.
This pull request (eventually)
How to test
Install the dependency:
pip install argus-server[allauth-mfa]
orpip install django-allauth[mfa]
The easiest way to configure is to use the extra-apps-machinery.
First make sure that argus-htmx overrides settings:
Note
override=True
! If this is not the case, the allauth templates will be completely unstyled and white.Then set EXTRA_APPS as an environment-variable like so (shell-dependent):
then finally
allauth.json
needs to look like this:MFA_TOTP_TOLERANCE is to account for clock drift. 0 is default. 1 is for network lag, 2 works for TOTP smartcards. Lower is better.
Run migrations.
allauth.account
adds the tablesaccount_emailaddress
andaccount_emailconfirmation
.allauth.mfa
adds the tablesmfa_authenticator
.You must be logged in and you must have an email address verified the allauth way. Then you can visit '/accounts/2fa' to get the QR code/magic string to set up a totp provider.
OAuth2/SAML/OIDC
Install the dependency:
pip install argus-server[allauth-social]
orpip install django-allauth[socialaccount]
Add to allauth.json:
This is JSON so validate with
jq
or something to ensure that right commas are in place, JSON doesn't like comma before}
.Run migrations. The tables
socialaccount_socialaccount
,socialaccount_socialapp
andsocialaccount_socialtoken
are added.Finally one app per provider is needed, here showing
dataporten
:The settings for the provider needs to be set per site so directly in a settings-file. Here's copying the values used for PSA:
At this point there's a new page on
/accounts/3rdparty/
.Contributor Checklist
Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to Argus can be found in the
Development docs.
Known missing
Delete as they are fixed.