Laravel Authentication 12
Last reviewed Oct 28, 2026
Prompt Details
Prompt Composition
3prompts
- PHP 8.4128 lines · 4.4K tokens
- Laravel 1259 lines · 1.6K tokens
- Laravel Authentication 1285 lines · 4.2K tokens
Total272 lines · 10.2K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 89
- 95
- 98
- 117
- 187
- 201
- 203
- 208
- 209
- 214
- 256
- 294
- 295
- 307
- 312
- 323
- 338
- 340
- 347
- 352
- 354
- 362
- 367
- 384
- 390
- 409
- 434
- 470
- 502
- 522
- 532
- 552
- 601
- 611
- 613
- 614
- 639
- 640
- 674
- 732
- 770
- 776
- 798
- 807
- 829
- 837
- 862
- 863
- 915
- 916
- 918
- 940
- 942
- 1004
- 1275
- 1333
- 1395
Prompt Preview
Apply the Laravel 12 prompt and its PHP 8.4 baseline first. These rules cover Laravel 12 guards, providers, authenticated sessions, authorization, and account recovery, plus optional Sanctum 4.3.3 and Fortify 1.40.0 integrations. The passkey rules apply to Fortify with the laravel/passkeys PHP package 0.2.1.
Guards, providers, and login decisions
- Select guards, providers, authenticatable models, and password brokers from trusted configuration; align
auth:<guard>, credential checks, the authenticated user, and authorization with the same identity domain. - Pass an allowlisted array of validated scalar credentials to
Auth::attempt()orattemptWhen(); add tenant and enabled-account conditions on the server. Do not hash the submitted password first or let request fields supply arbitrary credential predicates. - Recheck disabled-account and tenant-membership restrictions on subsequent session, remember-cookie, and bearer-token requests; conditions supplied to
attempt()are not automatically reapplied when an existing identity is restored. - Restrict
login(),loginUsingId(),onceUsingId(), andsetUser()to flows that have already proved identity and satisfied required factors; these APIs do not verify a password. Directattempt(),once(), Basic authentication, and custom token-issuance endpoints also do not execute Fortify's MFA pipeline. - Give unknown accounts, incorrect passwords, and disabled accounts the same public failure shape. Attach login throttling explicitly to custom endpoints;
Auth::attempt()is not a rate limiter. Combine canonical