mirror of
https://github.com/velocitatem/cvfs.git
synced 2026-05-31 08:43:37 +00:00
use raw issuer for discovery
This commit is contained in:
@@ -2,7 +2,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from urllib.parse import urlparse, urlunparse
|
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
from jose import JWTError, jwt
|
from jose import JWTError, jwt
|
||||||
@@ -24,23 +23,7 @@ class TokenValidationError(Exception):
|
|||||||
def _normalize_issuer(value: str | None) -> str | None:
|
def _normalize_issuer(value: str | None) -> str | None:
|
||||||
if not value:
|
if not value:
|
||||||
return None
|
return None
|
||||||
parsed = urlparse(value.strip())
|
return value.strip().rstrip("/")
|
||||||
path = parsed.path.rstrip("/")
|
|
||||||
if not path:
|
|
||||||
return urlunparse((parsed.scheme, parsed.netloc, "", "", "", ""))
|
|
||||||
segments = [segment for segment in path.split("/") if segment]
|
|
||||||
if (
|
|
||||||
len(segments) >= 4
|
|
||||||
and segments[0] == "application"
|
|
||||||
and segments[1] == "o"
|
|
||||||
and segments[2] == "authorize"
|
|
||||||
):
|
|
||||||
segments.pop(2)
|
|
||||||
normalized_path = "/" + "/".join(segments)
|
|
||||||
normalized = urlunparse(
|
|
||||||
(parsed.scheme, parsed.netloc, normalized_path.rstrip("/"), "", "", "")
|
|
||||||
)
|
|
||||||
return normalized.rstrip("/")
|
|
||||||
|
|
||||||
|
|
||||||
class OidcTokenValidator:
|
class OidcTokenValidator:
|
||||||
|
|||||||
Reference in New Issue
Block a user