Repository navigation
[PUI] Add 2FA login - #7469
[PUI] Add 2FA login#7469
Conversation
This reverts commit 717001d.
✅ Deploy Preview for inventree-web-pui-preview canceled.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7469 +/- ##
==========================================
- Coverage 83.96% 83.94% -0.03%
==========================================
Files 1066 1066
Lines 46618 46673 +55
Branches 1389 1392 +3
==========================================
+ Hits 39144 39180 +36
- Misses 7112 7121 +9
- Partials 362 372 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
@matmair seems like a very good approach to work around this issue |
|
Awesome that you implemented this, this was stopping me from using 2FA on my home instance. The question is just, what are we gonna do if we deprecate CUI? Will we still keep that view for entering the TOPT code? Or is there a possibility, we can directly implement that into PUI? |
|
@wolflu05 my plan is to leave this in when we remove CUI, it is only a very small part - you can check out what this removal would look like here: matmair#174 I do not think we should implement the different 2fa factors ourself (we support 3 rn) as that would create a lot of surfaces to make costly security issues. EDIT: |
|
This is ready for review/merge - testing the frontend is proving to be very hard because we can't add MFA methods via API (yet - that is coming with #6293) |
But this would enable use to build our own 2FA input directly in PUI and really get rid of all CUI code. In your linked allauth roadmap they mention:
If they support 2FA via API, its not "our responsibility" with custom API code to built it secure anymore, because as I understand, they want to implement the critical backend API layer we could just use, and build our own frontend around it? |
|
Yes, the switch will enable that. It will however require a complete review and possibly rewrite of our auth processes/integrations. This might take a while as it has grown over the years. |
|
@matmair nice work, thanks for the fix |
* Add `2fa_urls` * Add new fields to serializer * Add new interface to PUI interfaces * fix url resolving * add frontend redirect for MFA login * redirect login if mfa is required * Merege upstream/master into branch * reset default login * remove mfa states * fix auth args * add handler for MFA redirect auth * Revert "Merege upstream/master into branch" This reverts commit 717001d. * revert api version bump * revert frontend error handling change * reduce complexity * reset schema text * Add e2e test for MFA login url * accept either POST or body data for login pre-check * remove CUI test * style fixes
This PR adds the option to use the CUI 2FA login method for PUI. The user is automatically send to the appropriate screen, can enter their default 2FA method (TOTP code, backup code, HOTP) and is then redirected to the PUI home screen.
Screen.Recording.2024-06-18.at.13.00.50.mov
This method respects CRSF and is stateless - which should make it pretty hard to circumvent.
Closes #6200