Skip to content

Recognize Authenticate middleware referenced by class - #1327

Open
riesjart wants to merge 1 commit into
dedoc:mainfrom
riesjart:recognize-authenticate-middleware-class
Open

riesjart wants to merge 1 commit into
dedoc:mainfrom
riesjart:recognize-authenticate-middleware-class

Conversation

@riesjart

@riesjart riesjart commented Nov 9, 2026

Copy link
Copy Markdown

Authenticate::using('sanctum') resolves to Illuminate\Auth\Middleware\Authenticate:sanctum rather than auth:sanctum, so routes using it got no 401 response and no security requirement.

ErrorResponsesExtension already accepts Authorize::class.':' next to can:. This does the same for Authenticate, in both the error response extension and the default patterns of MiddlewareAuthSecurityStrategy.

Route::get('posts', [PostController::class, 'index'])
    ->middleware(Authenticate::using('sanctum'));

@riesjart
riesjart marked this pull request as ready for review November 9, 2026 10:40
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.

1 participant