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

Refactor AccessToken view to allow adding extra parameters. #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions provider/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,11 @@ def error_response(self, error, mimetype='application/json', status=400,
return HttpResponse(json.dumps(error), mimetype=mimetype,
status=status, **kwargs)

def access_token_response(self, access_token):
def access_token_response_data(self, access_token):
"""
Returns a successful response after creating the access token
as defined in :rfc:`5.1`.
Returns access token data as defined in :rfc:`5.1`.

Derived classes can override to add extra parameters.
"""

response_data = {
Expand All @@ -487,6 +488,15 @@ def access_token_response(self, access_token):
except ObjectDoesNotExist:
pass

return response_data

def access_token_response(self, access_token):
"""
Returns a successful response after creating the access token
as defined in :rfc:`5.1`.
"""
response_data = self.access_token_response_data(access_token)

return HttpResponse(
json.dumps(response_data), mimetype='application/json'
)
Expand Down