Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distinguish between AuthenticationError and AuthorizationError #1218

Open
lordi opened this issue Jul 4, 2024 · 1 comment
Open

Distinguish between AuthenticationError and AuthorizationError #1218

lordi opened this issue Jul 4, 2024 · 1 comment
Milestone

Comments

@lordi
Copy link

lordi commented Jul 4, 2024

Is your feature request related to a problem? Please describe.

Right now, when a user is authenticated but lacks permissions, I raise AuthenticationError. This is not totally correct, because it returns 401, but for authorization failures I expect 403 (Forbidden).

Describe the solution you'd like

I suggest to add another exception to ninja.errors that specifically denotes an Authorization error and results in a 403 response.

@c4ffein
Copy link
Contributor

c4ffein commented Aug 10, 2024

@vitalik @lordi I made #1257 which should answer that need, please tell me if anything is missing
I'm still not sure this is the right way though, maybe the user should just return 403, {something} instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants