diff --git a/oidc_provider/lib/endpoints/authorize.py b/oidc_provider/lib/endpoints/authorize.py index 2ea3665..6972728 100644 --- a/oidc_provider/lib/endpoints/authorize.py +++ b/oidc_provider/lib/endpoints/authorize.py @@ -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() diff --git a/oidc_provider/views.py b/oidc_provider/views.py index 4850e30..b214c57 100644 --- a/oidc_provider/views.py +++ b/oidc_provider/views.py @@ -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)