feat: Adds API Tokens and Two-Factor Authentication - #512
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 Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds Sanctum personal access token management, optional TOTP-based two-factor authentication, login challenges, ability-scoped middleware across API controllers, security settings interfaces, API rate limiting, configurable API documentation access, localization, and extensive feature coverage. ChangesAPI access and two-factor authentication
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant Settings
participant ApiTokenApiController
participant ApiTokenService
participant Sanctum
Settings->>ApiTokenApiController: submit token name, abilities, expiry
ApiTokenApiController->>ApiTokenService: validate and create token
ApiTokenService->>Sanctum: persist personal access token
Sanctum-->>Settings: return plaintext token once
Settings->>ApiTokenApiController: revoke token id
ApiTokenApiController->>ApiTokenService: delete owned token
sequenceDiagram
participant User
participant LoginController
participant TwoFactorLoginHelper
participant ChallengeView
User->>LoginController: submit email and password
LoginController->>TwoFactorLoginHelper: attemptWhen credentials
TwoFactorLoginHelper-->>ChallengeView: pending 2FA challenge
User->>ChallengeView: submit TOTP or recovery code
ChallengeView->>LoginController: post 2fa_code
LoginController->>TwoFactorLoginHelper: verify code
TwoFactorLoginHelper-->>User: authenticate session
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
7784a3f to
4796e01
Compare
Enhances application security and external integration capabilities by introducing personal API token management and optional two-factor authentication (2FA).
accounts:read,transactions:write), optionally set expiration dates, and revoke API tokens from their settings. This enables secure programmatic access to the API for scripts and automations./docs/apiroute in non-local environments.laragear/two-factorpackage for TOTP, aligning with existing customizations without requiring a full migration to Laravel Fortify.Summary by CodeRabbit