We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There seems to be an incompatibility between leafs/csrf and leafs/auth that causes authentication middleware not to run when using dynamic routing.
leafs/csrf
leafs/auth
A minimal example:
require __DIR__ . '/vendor/autoload.php'; auth()->middleware('auth.required', function () { response()->exit(['unauthorised'], 401); }); app()->get('/secure', [ 'middleware' => 'auth.required', function () { response()->json(['message' => 'Hello World!']); } ]); app()->get('/{insecure}', [ 'middleware' => 'auth.required', function ($insecure) { response()->json(['message' => "Uh oh!"]); } ]); app()->csrf(); app()->run();
Using the above, a GET call to /secure will return a 401 error as expected.
/secure
But a GET call to /insecure (or since it's dynamic, anything that isn't /secure) will unexpectedly return:
/insecure
{"message":"Uh oh!"}
Simply commenting out, or removing, the line app()->csrf() and repeating the GET call to /insecure will return a 401 error as expected.
app()->csrf()
Versions in use:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
There seems to be an incompatibility between
leafs/csrf
andleafs/auth
that causes authentication middleware not to run when using dynamic routing.A minimal example:
Using the above, a GET call to
/secure
will return a 401 error as expected.But a GET call to
/insecure
(or since it's dynamic, anything that isn't/secure
) will unexpectedly return:Simply commenting out, or removing, the line
app()->csrf()
and repeating the GET call to/insecure
will return a 401 error as expected.Versions in use:
The text was updated successfully, but these errors were encountered: