slim-auth icon indicating copy to clipboard operation
slim-auth copied to clipboard

wildcards

Open LorenzBischof opened this issue 9 years ago • 4 comments

Hello,

Is it possible to use some form of wildcards when adding and allowing access to resources? Something like addResource('/api/*')?

Thanks

LorenzBischof avatar Mar 28 '15 14:03 LorenzBischof

@Lorenzbi Not at this point, no, although you might be able to use route groups to accomplish the same thing. I haven't experimented with that.

jeremykendall avatar Mar 28 '15 14:03 jeremykendall

@jeremykendall That would be perfect but sadly it doesn't work. It looks for /api/tasks and fails. It's a pain to add all the routes and allow each one.

LorenzBischof avatar Mar 28 '15 17:03 LorenzBischof

I'll look into it when I get a chance. It would be a really nice addition, I think. If you have any thoughts or suggestions between now and whenever I can get around to this, please let me know.

jeremykendall avatar Mar 28 '15 18:03 jeremykendall

@Lorenzbi One option would be to implement your own version of JeremyKendall\Slim\Auth\Middleware\Authorization. You'd simply need to update the $isAuthorized callback to accept wildcards (or whatever you prefer in your custom implementation).

jeremykendall avatar Mar 31 '15 14:03 jeremykendall