providers/oauth2: fix error when redirecting from an authorization error
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
3eacd8b754
commit
43f19f78bb
|
@ -6,7 +6,7 @@ from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.http.response import Http404
|
from django.http.response import Http404, HttpResponseRedirect
|
||||||
from django.shortcuts import get_object_or_404, redirect
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
@ -384,7 +384,7 @@ class AuthorizationFlowInitView(PolicyAccessView):
|
||||||
self.params = OAuthAuthorizationParams.from_request(self.request)
|
self.params = OAuthAuthorizationParams.from_request(self.request)
|
||||||
except AuthorizeError as error:
|
except AuthorizeError as error:
|
||||||
error.to_event(redirect_uri=error.redirect_uri).from_http(self.request)
|
error.to_event(redirect_uri=error.redirect_uri).from_http(self.request)
|
||||||
raise RequestValidationError(redirect(error.create_uri()))
|
raise RequestValidationError(HttpResponseRedirect(error.create_uri()))
|
||||||
except OAuth2Error as error:
|
except OAuth2Error as error:
|
||||||
error.to_event().from_http(self.request)
|
error.to_event().from_http(self.request)
|
||||||
raise RequestValidationError(
|
raise RequestValidationError(
|
||||||
|
@ -401,7 +401,7 @@ class AuthorizationFlowInitView(PolicyAccessView):
|
||||||
self.params.state,
|
self.params.state,
|
||||||
)
|
)
|
||||||
error.to_event(redirect_uri=error.redirect_uri).from_http(self.request)
|
error.to_event(redirect_uri=error.redirect_uri).from_http(self.request)
|
||||||
raise RequestValidationError(redirect(error.create_uri()))
|
raise RequestValidationError(HttpResponseRedirect(error.create_uri()))
|
||||||
|
|
||||||
def resolve_provider_application(self):
|
def resolve_provider_application(self):
|
||||||
client_id = self.request.GET.get("client_id")
|
client_id = self.request.GET.get("client_id")
|
||||||
|
|
Reference in New Issue