Move allow logic to authorize view.

This commit is contained in:
juanifioren 2015-06-15 16:04:44 -03:00
parent db001cae1e
commit 124c7366fa
2 changed files with 8 additions and 10 deletions

View file

@ -80,14 +80,7 @@ class AuthorizeEndpoint(object):
except Client.DoesNotExist: except Client.DoesNotExist:
raise ClientIdError() raise ClientIdError()
def create_response_uri(self, allow): def create_response_uri(self):
if not allow:
raise AuthorizeError(
self.params.redirect_uri,
'access_denied',
self.grant_type)
try: try:
self.validate_params() self.validate_params()

View file

@ -73,7 +73,12 @@ class AuthorizeView(View):
allow = True if request.POST.get('allow') else False allow = True if request.POST.get('allow') else False
try: try:
uri = authorize.create_response_uri(allow) if not allow:
raise AuthorizeError(authorize.params.redirect_uri,
'access_denied',
authorize.grant_type)
uri = authorize.create_response_uri()
return HttpResponseRedirect(uri) return HttpResponseRedirect(uri)