From 08acc7ba41a020a7840c1fc9f11b45ed0e00b65c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 1 Mar 2022 15:29:21 +0000 Subject: [PATCH] providers/oauth2: fix invalid launch URL being generated --- authentik/providers/oauth2/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/authentik/providers/oauth2/models.py b/authentik/providers/oauth2/models.py index 4282ae6b0..a103fee26 100644 --- a/authentik/providers/oauth2/models.py +++ b/authentik/providers/oauth2/models.py @@ -7,7 +7,7 @@ from dataclasses import asdict, dataclass, field from datetime import datetime from hashlib import sha256 from typing import Any, Optional -from urllib.parse import urlparse +from urllib.parse import urlparse, urlunparse from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKey from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey @@ -266,8 +266,8 @@ class OAuth2Provider(Provider): if self.redirect_uris == "": return None main_url = self.redirect_uris.split("\n", maxsplit=1)[0] - launch_url = urlparse(main_url) - return main_url.replace(launch_url.path, "") + launch_url = urlparse(main_url)._replace(path="") + return urlunparse(launch_url) @property def component(self) -> str: