Let permissions classes customise failed responses #7809
Unanswered
zacps
asked this question in
Ideas & Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Checklist
master
branch of Django REST framework.I've been looking into adding support for django rest framework in django-oidc-provider.
The two things I'd like to implement are authentication and permissions classes for OAuth 2.0 Bearer authentication (RFC6750).
The Authentication class is straight-forward. I can simply check the token and respond with 401 if it doesn't exist or is invalid. The API also lets me set the correct
WWW-Authenticate
header as per RFC6750#3.However, it's not possible to implement a permissions class to check token scopes which is compatible with RFC6750. Section 3 states (emphasis mine):
This is because the only options for a failing permissions class are to return
False
and get 403, or raise a 404 exception.I'm not sure how the api should be expanded to accommodate this, an equivalent
authenticate_header
method on thePermission
class may be enough, or there may be a better approach.Beta Was this translation helpful? Give feedback.
All reactions