laravel-json-api / laravel

JSON:API for Laravel applications
MIT License
541 stars 41 forks source link

Add configuration setting for 'route action middleware' #266

Closed DellanX closed 7 months ago

DellanX commented 7 months ago

Implements #265

Specifically, a developer can define additional middleware for route actions. This change allows my server to successfully add my Oauth2.0 scope checks to my desired API endpoints. I can successfully set the scopes as User.Group.Update or User.Chat.Update to my tokens, and be blocked on API requests if I don't have the required scope.

Note, that for my case, I defined a closure that I provide to each call of the routeActionMiddleware function. I'd still like to have it defined on the server once, but didn't see a way to implement that without significant refactors.

Finally, I can definitely clean this up as desired. Let me know if a different name/key is preferred, or if you want me to remove the type annotations.

lindyhopchris commented 7 months ago

Closing in favour of #268