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

Dynamic route in ignore rule not working

Open benmajor opened this issue 5 years ago • 2 comments

When a route contains a dynamic element and is passed to the ignore directive in the constructor, the route is not ignored.

For example, if the ignore directive looks like this:

'ignore' => [ '/user/{id:[0-9]+}/activate/' ]

And we visit the URL:

https://example.com/user/1/activate/

We receive the 401, because no token is passed. Is there a workaround for this?

benmajor avatar Jan 03 '20 14:01 benmajor

Normal regexps should work. Something like following?

'ignore' => [ '/user/[0-9]+/activate/' ]

tuupola avatar Jan 03 '20 17:01 tuupola

Yes, that works. The issue I have is that I am actually building the ignore array from a YAML file, which also builds the routes in Slim, so it's nice to be able to use Slim's pattern for the ignore path. See the PR I have submitted, it converts Slim's patterns to PCRE-compliant strings.

benmajor avatar Jan 03 '20 17:01 benmajor