Skip to content

LG-13421 | Adds GpoVerifyByMailPolicy#10844

Merged
n1zyy merged 14 commits intomainfrom
mattw/LG-13421_GpoVerifyByMailPolicy
Jun 27, 2024
Merged

LG-13421 | Adds GpoVerifyByMailPolicy#10844
n1zyy merged 14 commits intomainfrom
mattw/LG-13421_GpoVerifyByMailPolicy

Conversation

@n1zyy
Copy link
Contributor

@n1zyy n1zyy commented Jun 20, 2024

🎫 Ticket

Link to the relevant ticket:
LG-13421

🛠 Summary of changes

This adds a GpoVerifyByMailPolicy class, encapsulating all logic about whether the GPO Verify by Mail functionality is available to a user.

Initially it leveraged the GpoMail class, but it ultimately made sense to fold all of that into the new Policy class.

This doesn't buy us a lot on its own, but this logic is going to get more complicated going forward, when we can expand it to take in a resolved_authn_context and implement more complex logic.

📜 Testing Plan

Ensure all existing tests pass.

This will become the source of truth for whether the user can make
use of GPO's verify-by-mail functionality.

changelog: Internal, GPO Verification, Establishes GpoVerifyByMailPolicy class
!gpo_mail.rate_limited? &&
!gpo_mail.profile_too_old?
policy = Idv::GpoVerifyByMailPolicy.new(current_user)
@user_can_request_another_letter = policy.resend_letter_available?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

153-155 became the resend_letter_available? method.

I am not convinced this memoization ever saves us anything, but 🤷

def gpo_letter_available?
FeatureManagement.gpo_verification_enabled? &&
current_user &&
!Idv::GpoMail.new(current_user).rate_limited?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And this became send_letter_available?.

@n1zyy n1zyy changed the title [WIP] LG-13421 | Adds GpoVerifyByMailPolicy LG-13421 | Adds GpoVerifyByMailPolicy Jun 26, 2024
@n1zyy n1zyy marked this pull request as ready for review June 26, 2024 19:03
@n1zyy n1zyy requested a review from a team June 26, 2024 19:03
!Idv::GpoMail.new(current_user).rate_limited?
return false unless current_user
policy = Idv::GpoVerifyByMailPolicy.new(current_user)
policy.send_letter_available?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

20 and 21 (and many instances of this across these files) could be inclined to Idv::GpoVerifyByMailPolicy.new(current_user).send_letter_available?, but I'm of the school of thought that it's cleaner to do it across two simple lines, and that the memory impact of optimizing for readability is negligible.

class GpoMail
attr_reader :current_user
class GpoVerifyByMailPolicy
attr_reader :user
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 is fun: initially this was a new class, but then I moved over enough from GpoMail that GitHub has solved the Ship of Theseus problem for us.

Copy link
Contributor

@matthinz matthinz left a comment

Choose a reason for hiding this comment

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

LGTM, just a lint issue in CI

Some day I am going to run rubocop _before_ pushing changes...
@n1zyy n1zyy merged commit 42532ef into main Jun 27, 2024
@n1zyy n1zyy deleted the mattw/LG-13421_GpoVerifyByMailPolicy branch June 27, 2024 17:12
jmhooper added a commit that referenced this pull request Jun 28, 2024
In #10871 we added a requirement that 2 pieces of fair evidence are required during verification. This is active whenever a SP requests biometric comparison. This commit adds enforcement of that requirement. It uses the `GpoVerifyForm` added in #10844 to disallow sends when that requirement is in place.

changelog: User-Facing Improvements, Verify By Mail Flow, The verify by mail flow enforces the 2 pieces of fair evidence requirement which disallows verify by mail when a SP requests an authn context with the requirement.
jmhooper added a commit that referenced this pull request Jul 2, 2024
…10886)

In #10871 we added a requirement that 2 pieces of fair evidence are required during verification. This is active whenever a SP requests biometric comparison. This commit adds enforcement of that requirement. It uses the `GpoVerifyForm` added in #10844 to disallow sends when that requirement is in place.

changelog: User-Facing Improvements, Verify By Mail Flow, The verify by mail flow enforces the 2 pieces of fair evidence requirement which disallows verify by mail when a SP requests an authn context with the requirement.
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.

4 participants