From ce011748bc09322bd8b24192102ee08e236ad59a Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 16 Apr 2026 10:18:21 +0800 Subject: [PATCH] =?UTF-8?q?refactor(oidc):=20=E7=A7=BB=E9=99=A4Discovery?= =?UTF-8?q?=E5=85=83=E6=95=B0=E6=8D=AE=E4=B8=AD=E7=9A=84localhost=E6=97=A0?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E6=9B=BF=E6=8D=A2=20-=20=E7=94=B1=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BD=91=E7=BB=9C=E9=85=8D=E7=BD=AE=E8=87=AA=E8=A1=8C?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package/yuxi/services/oidc_service.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/backend/package/yuxi/services/oidc_service.py b/backend/package/yuxi/services/oidc_service.py index 5f6badd1..2c9eff26 100644 --- a/backend/package/yuxi/services/oidc_service.py +++ b/backend/package/yuxi/services/oidc_service.py @@ -133,16 +133,10 @@ class OIDCProviderMetadata: response.raise_for_status() metadata = response.json() - # 替换端点地址中的 localhost 为 host.docker.internal,以便容器内访问 - def replace_localhost(url: str | None) -> str | None: - if url and "localhost" in url: - return url.replace("localhost", "host.docker.internal") - return url - - self.authorization_endpoint = replace_localhost(metadata.get("authorization_endpoint")) - self.token_endpoint = replace_localhost(metadata.get("token_endpoint")) - self.userinfo_endpoint = replace_localhost(metadata.get("userinfo_endpoint")) - self.end_session_endpoint = replace_localhost(metadata.get("end_session_endpoint")) + self.authorization_endpoint = metadata.get("authorization_endpoint") + self.token_endpoint = metadata.get("token_endpoint") + self.userinfo_endpoint = metadata.get("userinfo_endpoint") + self.end_session_endpoint = metadata.get("end_session_endpoint") # 登录 URL 生成至少需要 authorization_endpoint。 if not self.authorization_endpoint: