Skip to content

Improve consistency when marking users as fully authenticated after successful multi-factor authenticator setup#8431

Merged
mitchellhenke merged 1 commit intomainfrom
mitchellhenke/confirmation-contexts-2
May 19, 2023
Merged

Improve consistency when marking users as fully authenticated after successful multi-factor authenticator setup#8431
mitchellhenke merged 1 commit intomainfrom
mitchellhenke/confirmation-contexts-2

Conversation

@mitchellhenke
Copy link
Contributor

🛠 Summary of changes

When setting up a new authenticator, some of the controllers implement a mark_user_as_fully_authenticated method when we have a method in the shared TwoFactorAuthenticatableMethods concern. This PR removes the per-controller implementation in favor of using handle_valid_verification_for_confirmation_context.

@mitchellhenke mitchellhenke requested a review from aduth May 18, 2023 19:17
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is only used by the otp_verification_controller when in a confirmation context, so it was moved there. Ideally I would have moved it in #8424

@mitchellhenke mitchellhenke force-pushed the mitchellhenke/confirmation-contexts-2 branch from 7edc63f to 3c1b7b6 Compare May 18, 2023 19:43
@mdiarra3
Copy link
Contributor

Looks like legitimate test failures, due to returning the method instead of the proper authentication type.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to follow how OTP previously would have set user_session[TwoFactorAuthenticatable::NEED_AUTHENTICATION] to false, or whether it would have (or even if it needed to?). Just flagging since that will be happening now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously it wouldn't have for phone OTP confirmation. We did do it when confirming other methods though, so this brings it all in line to always set it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I assume this may cause some additional analytics to be logged via mark_user_session_authenticated's call to mark_user_session_authenticated_analytics. Should we have specs for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, they were causing a failure, added a few changes to add specs around it.

…uccessful multi-factor authenticator setup

changelog: Internal, Authentication, Improve consistency when marking users as fully authenticated after successful multi-factor authenticator setup
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/confirmation-contexts-2 branch from 3c1b7b6 to b7f4c4b Compare May 19, 2023 15:59
@mitchellhenke mitchellhenke merged commit 1ebb909 into main May 19, 2023
@mitchellhenke mitchellhenke deleted the mitchellhenke/confirmation-contexts-2 branch May 19, 2023 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants