tuupola/slim-jwt-auth

[Question] How to ignore path with specific HTTP method?

samuelgfeller opened this issue · 2 comments

Let's say the path GET /posts is public and should work without token but the POST, PUT, DELETE /posts path should be authorised; how can I do that?

Does it even make sense to want that?

You could create a custom rule which is mixture of RequestMethodRule and RequestPathRule.

$app = new Slim\App;
$app->add(new JwtAuthentication([
    "rules" => [
        new YourCustomRule([
            ...
        ])
    ]
]));

I will try to thank you