Skip to content

Check if a user is authenticated before checking whether they have completed the verify info step#7787

Merged
jmhooper merged 1 commit intomainfrom
jmhooper-clean-up-review-controller
Feb 7, 2023
Merged

Check if a user is authenticated before checking whether they have completed the verify info step#7787
jmhooper merged 1 commit intomainfrom
jmhooper-clean-up-review-controller

Conversation

@jmhooper
Copy link
Contributor

@jmhooper jmhooper commented Feb 7, 2023

Currently we have some code in place to check that a user has completed the verify step in the review controller. This code supports us when both the FSM verify step and the new verify step are in place. It will be removed in this change request: #7747

After deploying the IDP with the feature flag enabled we discovered a bug in this code. This code calls idv_session in a before action that is added prior to adding the IdvSession concern.

The IdvSessnion concern adds a before action to confirm the user is authenticated. This concern includes a before action to confirm the user is authenticated since calling idv_session with no user session results in a NoMethodError. Having the confirm_verify_info_complete prior to that before action is problematic since it calls idv_session.

This commit works around the issue by guarding the before action with a check to confirm the user is authenticated. This is not the most elegant solution, but it should work and as stated previously will be removed in #7747.

…pleted the verify info step

Currently we have some code in place to check that a user has completed the verify step in the review controller. This code supports us when both the FSM verify step and the new verify step are in place. It will be removed in this change request: #7747

After deploying the IDP with the feature flag enabled we discovered a bug in this code. This code calls `idv_session` in a before action that is added prior to adding the `IdvSession` concern.

The `IdvSessnion` concern adds a before action to confirm the user is authenticated. This concern includes a before action to confirm the user is authenticated since calling `idv_session` with no user session results in a `NoMethodError`. Having the `confirm_verify_info_complete` prior to that before action is problematic since it calls `idv_session`.

This commit works around the issue by guarding the before action with a check to confirm the user is authenticated. This is not the most elegant solution, but it should work and as stated previously will be removed in #7747.

[skip changelog]
redirect_to idv_verify_info_url
end
return unless IdentityConfig.store.doc_auth_verify_info_controller_enabled
return unless user_fully_authenticated?
Copy link
Contributor

Choose a reason for hiding this comment

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

would before_action :confirm_two_factor_authenticated at the top work?

Copy link
Contributor

@soniaconnolly soniaconnolly left a comment

Choose a reason for hiding this comment

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

LGTM, with explanation in Slack that just checking idv_session is non-nil would result in a 500, so the full authentication check is needed. Yay tests!

@jmhooper jmhooper changed the title Check if a user is authenticate before checking whether they have completed the verify info step Check if a user is authenticated before checking whether they have completed the verify info step Feb 7, 2023
@jmhooper jmhooper merged commit 4e72b02 into main Feb 7, 2023
@jmhooper jmhooper deleted the jmhooper-clean-up-review-controller branch February 7, 2023 19:30
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