Move allow logic to authorize view.
This commit is contained in:
parent
db001cae1e
commit
124c7366fa
2 changed files with 8 additions and 10 deletions
|
@ -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()
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue