Skip to content

Commit 9292d3b

Browse files
author
Massimiliano
committed
better docstrings - close #47
1 parent 21b0426 commit 9292d3b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

oauth2_provider/decorators.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ def protected_resource(scopes=None, validator_cls=OAuth2Validator, server_cls=Se
1313
"""
1414
Decorator to protect views by providing OAuth2 authentication out of the box, optionally with
1515
scope handling.
16+
17+
@protected_resource()
18+
def my_view(request):
19+
# An access token is required to get here...
20+
# ...
21+
pass
22+
1623
"""
1724
_scopes = scopes or []
1825

@@ -34,6 +41,13 @@ def rw_protected_resource(scopes=None, validator_cls=OAuth2Validator, server_cls
3441
Decorator to protect views by providing OAuth2 authentication and read/write scopes out of the
3542
box.
3643
GET, HEAD, OPTIONS http methods require "read" scope. Otherwise "write" scope is required.
44+
45+
@rw_protected_resource()
46+
def my_view(request):
47+
# If this is a POST, you have to provide 'write' scope to get here...
48+
# ...
49+
pass
50+
3751
"""
3852
_scopes = scopes or []
3953

0 commit comments

Comments
 (0)