Add support for OAuth2 in the web API
Review Request #9030 — Created June 22, 2017 and submitted
Djblets now supports OAuth2 authentication in the Web API. Documentation
has been added, in the form of a guide, showing how to enable OAuth2
token access in applications.This support is added via the
django_oauth_toolkit
package, which is a
development dependnecy but not a deployment dependency. The OAuth2
features will simply be non-functional if the dependency is not
installed.Some minor cleanup has been done in the
ResourceAPITokenMixin
to
help ensure methods from mixins don't override eachother. Additionally,
TheWebAPITestCaseMixin
was fixed so that additional arguments can be
passed to the underlying client request.Based on work by: Minh Le Hoang (https://reviews.reviewboard.org/r/7997/)
- Ran unit tests.
- Tested this with an upcoming change for adding OAuth2 token access to
Review Board. - Built the docs and read through them.
Description | From | Last Updated |
---|---|---|
You posted the wrong revision range. The latest diff here includes other changes. |
david | |
F841 local variable 'old__setattr__' is assigned to but never used |
reviewbot | |
E501 line too long (85 > 79 characters) |
reviewbot | |
W391 blank line at end of file |
reviewbot | |
E501 line too long (85 > 79 characters) |
reviewbot | |
Is there any reason to not include request in the kwargs in the function? |
david | |
Would be a little bit nicer as: if (valid and self.verify_request(request, r.access_token, r.user)): return r.user else: return None |
david | |
I'm on the edge of my seat. |
david | |
When importing just a single item, continuation is ok. |
david | |
E501 line too long (85 > 79 characters) |
reviewbot | |
E303 too many blank lines (3) |
reviewbot | |
F401 'oauth2_provider.models.AccessToken' imported but unused |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
E703 statement ends with a semicolon |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
E703 statement ends with a semicolon |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
E703 statement ends with a semicolon |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
Isn't this part of another change? |
david | |
F401 'djblets.webapi.errors.PERMISSION_DENIED' imported but unused |
reviewbot | |
F401 'djblets.webapi.errors.OAUTH_EXPIRED_ERROR' imported but unused |
reviewbot | |
F401 'djblets.webapi.errors.NOT_LOGGED_IN' imported but unused |
reviewbot | |
Too many blank lines. |
david | |
E501 line too long (94 > 79 characters) |
reviewbot |
- Description:
-
Djblets now supports OAuth2 authentication in the Web API. Documentation
has been added, in the form of a guide, showing how to enable OAuth2 token access in applications. This support is added via the
django_oauth_toolkit
package, which is adevelopment dependnecy but not a deployment dependency. The OAuth2 features will simply be non-functional if the dependency is not installed. Some minor cleanup has been done in the
ResourceAPITokenMixin
tohelp ensure methods from mixins don't override eachother. Additionally, The WebAPITestCaseMixin
was fixed so that additional arguments can bepassed to the underlying client request. + + Based on work by: Minh Le Hoang (https://reviews.reviewboard.org/r/7997/)
- Change Summary:
-
- Add a mixin for django authentication backends.
- Update guide.
- Add screenshot of guide.
- Diff:
-
Revision 4 (+1303 -23)
- Added Files:
- Change Summary:
-
flake8 fixups
- Diff:
-
Revision 5 (+1303 -23)
Checks run (2 succeeded)
- Change Summary:
-
- Addressed David's issues.
- Now support token information stored in sessions so we don't need to auth every request.
- More unit tests!
- Diff:
-
Revision 6 (+1493 -26)
Checks run (1 failed, 1 succeeded)
flake8
- Change Summary:
-
Remove print statement
- Diff:
-
Revision 7 (+1494 -26)
Checks run (1 failed, 1 succeeded)
flake8
- Diff:
-
Revision 8 (+1493 -26)
Checks run (1 failed, 1 succeeded)
flake8
- Change Summary:
-
Flake8 fixups
- Diff:
-
Revision 10 (+1490 -26)
Checks run (2 succeeded)
- Change Summary:
-
Don't cause stack overflow in RB unit tests
- Commit:
-
2fe634ac42d307a056a6c8f156b9a57259a38955
- Diff:
-
Revision 11 (+1516 -36)
Checks run (2 succeeded)
- Commit:
-
2fe634ac42d307a056a6c8f156b9a57259a38955537d87249b52bd65039019b3d1ecb12976fa80a4
- Diff:
-
Revision 15 (+2596 -912)