Conversation
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? |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
And this became send_letter_available?.
| !Idv::GpoMail.new(current_user).rate_limited? | ||
| return false unless current_user | ||
| policy = Idv::GpoVerifyByMailPolicy.new(current_user) | ||
| policy.send_letter_available? |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
matthinz
left a comment
There was a problem hiding this comment.
LGTM, just a lint issue in CI
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.
…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.
🎫 Ticket
Link to the relevant ticket:
LG-13421
🛠 Summary of changes
This adds a
GpoVerifyByMailPolicyclass, 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_contextand implement more complex logic.📜 Testing Plan
Ensure all existing tests pass.