providers/oauth2: fix invalid launch URL being generated

This commit is contained in:
Jens Langhammer 2022-03-01 15:29:21 +00:00
parent 7bdd32506e
commit 08acc7ba41
1 changed files with 3 additions and 3 deletions

View File

@ -7,7 +7,7 @@ from dataclasses import asdict, dataclass, field
from datetime import datetime from datetime import datetime
from hashlib import sha256 from hashlib import sha256
from typing import Any, Optional 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.ec import EllipticCurvePrivateKey
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey
@ -266,8 +266,8 @@ class OAuth2Provider(Provider):
if self.redirect_uris == "": if self.redirect_uris == "":
return None return None
main_url = self.redirect_uris.split("\n", maxsplit=1)[0] main_url = self.redirect_uris.split("\n", maxsplit=1)[0]
launch_url = urlparse(main_url) launch_url = urlparse(main_url)._replace(path="")
return main_url.replace(launch_url.path, "") return urlunparse(launch_url)
@property @property
def component(self) -> str: def component(self) -> str: