Replies: 1 comment 4 replies
-
If you want to limit the entire application to only cases where you are two factor authenticated, adding I certainly don't want to make changes to the default behavior, there are plenty of applications where 2FA is only needed for some actions and not the entire application. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been thinking about janko/rodauth-rails#214, and how it could be valuable if Rodauth could support this directly. I think most applications will want to treat 2nd factor auth as the 2nd step of login; if the user authenticates with 1st factor and then navigates away, on login they should authenticate with 1st factor again. This is e.g. how GitHub's auth flow works.
I can also imagine a keeping the user logged in with 1st factor if they abort 2nd factor auth being a security issue. The user might own the account but may be unable to authenticate with 2nd factor at the moment, and go to home page assuming that login failed. Then another person could come, see the 1st factor already being authenticated, and have an easier time hacking into the account.
The configuration I suggested involves clearing the session when the user makes a request to a non-MFA auth page after login. A page is considered MFA auth page if it's one of
two_factor_auth_links
,two_factor_auth_path
orwebauthn_auth_js_path
. My solution unfortunately doesn't work withlogin_return_to_requested_location?
andtwo_factor_auth_return_to_requested_location?
being set totrue
, because those rely on login first redirecting to originally requested location, which would trigger the logout since it's a non-MFA page.I wanted to check if you would be interested in supporting this MFA flow in Rodauth itself. If yes, I could spend some more time trying to implement this, and would appreciate any pointers you might have 🙁
Beta Was this translation helpful? Give feedback.
All reactions