Feature | MFAGateService (Two-Factor Gate Decision Service)#135
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/openstackid/openapi/pr-135/ This page is automatically updated on each push to this PR. |
e65b45f to
19309fa
Compare
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/openstackid/openapi/pr-135/ This page is automatically updated on each push to this PR. |
19309fa to
25fc89f
Compare
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/openstackid/openapi/pr-135/ This page is automatically updated on each push to this PR. |
Task
Ref.: https://app.clickup.com/t/86ba2zfj8
Changes
New files
app/Services/Auth/ITwoFactorGateService.php— Interface definingrequiresChallenge(User $user, ?string $cookieToken): bool. Pure decision contract with no side effects.app/Services/Auth/MFAGateService.php— Concrete implementation. Returnstrueonly when the user requires 2FA and the device is not trusted (delegates toIDeviceTrustService).tests/Unit/MFAGateServiceTest.php— 5 unit tests covering: 2FA not required, enforced with no cookie, trusted device, untrusted/expired device, and empty-string cookie passthrough.Modified files
app/Services/Auth/TwoFactorServiceProvider.php— RegistersITwoFactorGateService → MFAGateServiceas a singleton.phpunit.xml— AddsMFAGateServiceTestto the Two Factor Authentication Test Suite.Requested GOAL
Current state
No service exists to determine whether a given login attempt requires a 2FA challenge.
Target state
MFAGateService implements a pure-decision method requiresChallenge(User $user, ?string $cookieToken): bool. It evaluates user policy and trusted-device state without writing session data, issuing OTPs, or modifying persistence.
TASKS
ACCEPTANCE CRITERIA
DEVELOPMENT NOTES
Key files:
Gotchas:
Risks:
Out of scope:
Issuing challenges, reading HTTP request, queueing cookies, rate limiting, audit logging.