Skip to content
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

Admin MFA #6350

Merged
merged 1 commit into from May 24, 2024
Merged

Admin MFA #6350

merged 1 commit into from May 24, 2024

Conversation

drbyte
Copy link
Member

@drbyte drbyte commented Mar 23, 2024

Add 2-factor-auth to admin login. Page for 2FA code shows after the Admin has successfully provided their password.
OTP codes are generated for use in conjunction with an app like Google Authenticator, etc.
To set up, the user scans the QR code into their browser or their Authenticator app.

Store owner can enable MFA via a config switch in "Admin->My Store".
Store owner can exempt certain users (should only be for automated logins like ShipStation or similar plugins which can't do MFA automatically).
Storeowner can "delete" MFA from an Admin user account as a means of resetting access if it's not working. User will re-set-up on next login.
User has choice of OTP or code-by-email when setting up MFA for their profile ... which can be done from their admin "My Account" page (link beside Logoff button), or upon next login.

Screen Shot 2024-03-23 at 4 11 52 AM Screen Shot 2024-05-24 at 4 51 19 PM Screen Shot 2024-05-24 at 4 51 00 PM Screen Shot 2024-05-24 at 4 50 54 PM Screen Shot 2024-05-24 at 4 50 46 PM Screen Shot 2024-05-24 at 4 50 41 PM Screen Shot 2024-05-24 at 4 50 31 PM

@proseLA
Copy link
Sponsor Contributor

proseLA commented Mar 24, 2024

are we planning on offering numerous choices? using google authenticator removes the need to check for expired tokens/codes as it is already a time based solution.

i have the code already.

@drbyte
Copy link
Member Author

drbyte commented Mar 24, 2024

are we planning on offering numerous choices? using google authenticator removes the need to check for expired tokens/codes as it is already a time based solution.

i have the code already.

Yes. GA would be the preferred primary OTP option. Are you interested in contributing it to core?

@proseLA
Copy link
Sponsor Contributor

proseLA commented Mar 24, 2024

are we planning on offering numerous choices? using google authenticator removes the need to check for expired tokens/codes as it is already a time based solution.
i have the code already.

Yes. GA would be the preferred primary OTP option. Are you interested in contributing it to core?

i'll let you have a look. if you want to add it to core, i have no problem with that. i have sold 0 of them.

the repo does not have the changes i made to this file. it seemed that the amount of notifiers needed was not worth the effort. on that file, i created a button for an admin to delete the 2FA seed for any user. once done, that user would need to create a new seed afterwards.

@proseLA
Copy link
Sponsor Contributor

proseLA commented Mar 28, 2024

in looking at my code, it seems that i based it on an outside library. unfortunately that library has not been updated in a number of years, and newer versions of php will not work without modifications.

when i have more time, i will revisit that plugin and see about updating it.

@drbyte
Copy link
Member Author

drbyte commented Mar 29, 2024

in looking at my code, it seems that i based it on an outside library. unfortunately that library has not been updated in a number of years, and newer versions of php will not work without modifications.

Yes, I observed the same: It's not been updated in awhile. But it's still recommended from a lot of less-older sources, rightly or wrongly. Most other libraries co-depend on multiple additional libraries, making it much more complex to integrate.

That said, I've got it working with minor updates to the library, albeit an extensive rewrite to the handler function, mostly to hybridize the email one in this PR with the GA lib. Gotta refine it a bit before updating this PR with it.

@scottcwilson
Copy link
Sponsor Contributor

If you merge this into master, we could add database changes to support MFA switchability per-user.

@drbyte
Copy link
Member Author

drbyte commented May 15, 2024

MultiFactorAuth class reworked to incorporate various features from more updated implementations, but still be a standalone class.

Store owner can enable MFA via a config switch in "Admin->My Store".
Store owner can exempt certain users (should only be for automated logins like ShipStation or similar plugins which can't do MFA automatically).
Storeowner can "delete" MFA from an Admin user account as a means of resetting access if it's not working. User will re-set-up on next login.
User has choice of OTP or code-by-email when setting up MFA for their profile ... which can be done from their admin "My Account" page (link beside Logoff button), or upon next login.

@drbyte drbyte force-pushed the mfa branch 3 times, most recently from a86706a to 1252a29 Compare May 15, 2024 22:06
Supports OTP via Authenticator app or Code-by-Email verification methods
@drbyte drbyte merged commit be81b79 into zencart:master May 24, 2024
8 checks passed
@drbyte drbyte deleted the mfa branch May 24, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants