refactor(dashboard-auth): drop redundant _interactive_providers helper

list_session_providers() already filters on supports_session=True, so the
new helper re-filtered an already-filtered list. Call it directly at the
single auto-SSO call site.
This commit is contained in:
teknium1 2026-06-29 04:04:48 -07:00 committed by Teknium
parent f5ecbe1ec6
commit 61f56d27db

View file

@ -137,18 +137,6 @@ def _unauth_response(request: Request, *, reason: str) -> Response:
return RedirectResponse(url=login_url, status_code=302)
def _interactive_providers():
"""Registered providers that can drive an interactive browser login.
A token-only credential (e.g. a drain/service provider) advertises
``supports_session = False`` and is not an auto-SSO candidate.
"""
return [
p for p in list_session_providers()
if getattr(p, "supports_session", True)
]
def _auto_sso_response(request: Request) -> Response | None:
"""Maybe auto-initiate the portal OAuth redirect on an unauth HTML load.
@ -187,7 +175,9 @@ def _auto_sso_response(request: Request) -> Response | None:
clear_sso_attempt_cookie(resp, prefix=prefix_from_request(request))
return resp
providers = _interactive_providers()
# list_session_providers() already filters on supports_session=True, so
# token-only credentials (drain/service providers) are never candidates.
providers = list_session_providers()
if len(providers) != 1:
# Zero → nothing to redirect to. Two+ → user must choose at /login.
return None