mirror of
https://github.com/TencentCloud/Octop.git
synced 2026-10-23 06:50:19 +08:00
* feat(auth): add pluggable Feishu OAuth and multi-identity SSO binds Introduce App OAuth (Feishu) alongside OIDC, persist multiple SSO identities per user, and simplify the admin provider UI for coexistence. * fix(dashboard): restore OIDC SSO checklist and login preview Keep the OIDC admin card unchanged; only App OAuth cards use the callback-only aside. * feat(auth): add DingTalk and WeCom App OAuth SSO adapters Enable dashboard login/bind for DingTalk and WeCom alongside Feishu, with WeCom CorpApp wwlogin (CorpID + Agent ID) and DingTalk authCode callback support. * feat(dashboard): redesign account SSO bind list and default names Use an icon + status + action row list in personal settings for App OAuth binds, and prefill empty provider display names in the admin SSO cards. * feat(dashboard): split admin SSO settings into per-provider tabs * fix(auth): log SSO callback failures and silence httpx URL leaks * docs: changelog for multi-provider OAuth SSO * style: ruff format users/manager.py after SSO conflict merge Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: jubaoliang <jubaoliang@tencent.com> Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
"""Tests for public OIDC callback URL helpers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from starlette.requests import Request
|
|
|
|
from octop.api.common.public_base import resolve_public_base
|
|
from octop.infra.auth.sso.public_base import build_redirect_uri
|
|
|
|
|
|
def _request(*, scheme: str = "http", headers: list[tuple[bytes, bytes]] | None = None) -> Request:
|
|
return Request(
|
|
{
|
|
"type": "http",
|
|
"scheme": scheme,
|
|
"server": ("internal.example", 8080),
|
|
"path": "/",
|
|
"headers": headers or [(b"host", b"internal.example:8080")],
|
|
}
|
|
)
|
|
|
|
|
|
def test_resolve_public_base_uses_forwarded_proxy_headers() -> None:
|
|
request = _request(
|
|
headers=[
|
|
(b"host", b"internal.example:8080"),
|
|
(b"x-forwarded-proto", b"https"),
|
|
(b"x-forwarded-host", b"octop.example"),
|
|
]
|
|
)
|
|
|
|
assert resolve_public_base(request) == "https://octop.example"
|
|
|
|
|
|
def test_resolve_public_base_uses_request_url_without_proxy_headers() -> None:
|
|
request = _request(scheme="https", headers=[(b"host", b"octop.example")])
|
|
|
|
assert resolve_public_base(request) == "https://octop.example"
|
|
|
|
|
|
def test_build_redirect_uri_uses_oidc_callback_path() -> None:
|
|
assert (
|
|
build_redirect_uri("https://octop.example/")
|
|
== "https://octop.example/api/auth/oidc/callback"
|
|
)
|
|
|
|
|
|
def test_build_redirect_uri_accepts_oauth_callback_path() -> None:
|
|
assert (
|
|
build_redirect_uri("https://octop.example", "/api/auth/oauth/callback")
|
|
== "https://octop.example/api/auth/oauth/callback"
|
|
)
|