DDtKey / protect-endpoints

Authorization extension for popular web-frameworks to protect your endpoints
Apache License 2.0
203 stars 14 forks source link

Redirect to another page if not granted instead of error page #8

Closed RoDmitry closed 3 years ago

RoDmitry commented 3 years ago

I know I can make the redirect manually, but I think it's possible to make a redirect look good in macro, something like that: #[has_permissions("ROLE_ADMIN", redirect = "/login")]

That is the response, right? We can make a redirect there, if it was passed in macro. Does it make sense?

Upd: I guess not, that's repeating. We need middleware for that I guess.

DDtKey commented 3 years ago

Interesting idea I think this can be implemented, but as a rule it is needed globally for the project, and not for a specific endpoint 🤔