-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
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
Add ability to specify request type in optional patterns #64
Comments
|
@rustamwin If remove Authentication middleware in route, $currentUser->isGuest() alway return true. |
@hiscaler You should add optional routes to Authentication::class => [
'class' => Authentication::class,
'__construct()' => [
'authenticationFailureHandler' => Reference::to(PassportRequestErrorHandler::class),
],
'withOptionalPatterns()' => [
'optional' => [
'/en/products/[1-9]',
'products/product/view', // Don't forget adapt pattern for your case
]
]
], |
@vjik I will try. Thank you! |
@vjik Can not. GET /en/products/1 is return product 1 detail but withOptionalPatterns.optional
can't not know what's request method. |
and has a other question.
can't matched /en/products/123 |
@rustamwin Thank you! |
Valid setting is ['/en/products/[1-9]*'] , thank you. |
So i think should add check request method in Authentication.isOptional |
@hiscaler you want make optional authentication for GET request only and otherwise required (POST, DELETE, etc.)? |
@vjik yes, is only GET request, POST, DELETE is must authentication |
Need add ability to specify request type in optional patterns. |
Another idea: leave in |
like product/view if user is login will return 'favorite': true, if not login will return 'favorite': false
but if is use Authentication middleware, must login.
is can use follow code
but delete,update action url is like to view.
what can i do?
The text was updated successfully, but these errors were encountered: