From 43f19f78bb39263d771a45d868814d682b1d29d0 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 20 Mar 2021 22:06:45 +0100 Subject: [PATCH] providers/oauth2: fix error when redirecting from an authorization error Signed-off-by: Jens Langhammer --- authentik/providers/oauth2/views/authorize.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/authentik/providers/oauth2/views/authorize.py b/authentik/providers/oauth2/views/authorize.py index f943e7b18..fa8649917 100644 --- a/authentik/providers/oauth2/views/authorize.py +++ b/authentik/providers/oauth2/views/authorize.py @@ -6,7 +6,7 @@ from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit from uuid import uuid4 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.utils import timezone from django.utils.translation import gettext as _ @@ -384,7 +384,7 @@ class AuthorizationFlowInitView(PolicyAccessView): self.params = OAuthAuthorizationParams.from_request(self.request) except AuthorizeError as error: 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: error.to_event().from_http(self.request) raise RequestValidationError( @@ -401,7 +401,7 @@ class AuthorizationFlowInitView(PolicyAccessView): self.params.state, ) 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): client_id = self.request.GET.get("client_id")