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 CheckScopes and CheckForAnyScope Middleware #310
Add CheckScopes and CheckForAnyScope Middleware #310
Conversation
Built-in PHP CS Foxer did this, sorry!
@filippofortino I just released this. Can you also PR this to the docs of Sanctum? Thanks! |
Sure, don't know if i'm gonna be able to do that today, but will do it by tomorrow. I was thinking however, since Sanctum refers to scopes as abilities, would it be better to rename this two middlewares to CheckAbility and CheckForAnyAbilities? Of course you can already register them like so in 'abilities' => \Laravel\Sanctum\Http\Middleware\CheckScopes::class,
'ability' => \Laravel\Sanctum\Http\Middleware\CheckForAnyScope::class Let me know what you think and i can send a PR in case you agree. |
You can always try to see if Taylor would accept it 👍 |
I think it would break a lot of applications. |
@masterix21 this PR is just a week old |
@driesvints I'm talking about the idea to replace |
This will only replace the newly added middlewares in Sanctum, if you're using the ones in Passport they won't be affected. However, I'll send a PR later today and we'll see. |
@filippofortino a BC solution for now would be to move the functionality to the new traits and then re-use those traits in the old ones. Then add a |
@driesvints alright I'll do that! |
This PR add the CheckScopes middleware and CheckForAnyScopes middleware from Passport.
The code is basically copy-pasted from Passport.
This idea was discussed earlier today by @masterix21 and @themsaid on Twitter.
https://twitter.com/masterix21/status/1448212135578935296