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:
raise ClientIdError()
def create_response_uri(self, allow):
if not allow:
raise AuthorizeError(
self.params.redirect_uri,
'access_denied',
self.grant_type)
def create_response_uri(self):
try:
self.validate_params()

View file

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