Co-Authored-By: Zaid Marji <91486926+zaid-marji@users.noreply.github.com>
This commit is contained in:
Timothy Jaeryang Baek
2026-06-01 13:07:49 -07:00
parent 346dab3d8f
commit d64ef1803d
4 changed files with 35 additions and 2 deletions

View File

@@ -307,6 +307,7 @@ type Config = {
providers: {
[key: string]: string;
};
auto_redirect?: boolean;
};
ui?: {
pending_user_overlay_title?: string;

View File

@@ -183,10 +183,31 @@
await oauthCallbackHandler();
form = $page.url.searchParams.get('form');
// Auto-redirect to SSO when OAUTH_AUTO_REDIRECT is enabled and the
// deployment is unambiguously SSO-only (single provider, no login form,
// no LDAP). Suppressed by ?form=, ?error=, onboarding, trusted-header
// auth, or an existing session/token.
if ($config?.oauth?.auto_redirect && !form && !error) {
const providers = Object.keys($config?.oauth?.providers ?? {});
if (
providers.length === 1 &&
$config?.features?.auth !== false &&
$config?.features?.enable_login_form === false &&
!$config?.features?.enable_ldap &&
!$config?.features?.auth_trusted_header &&
!$config?.onboarding &&
!localStorage.token &&
!document.cookie.split('; ').some((c) => c.startsWith('token='))
) {
window.location.href = `${WEBUI_BASE_URL}/oauth/${providers[0]}/login`;
return;
}
}
loaded = true;
setLogoImage();
if (($config?.features.auth_trusted_header ?? false) || $config?.features.auth === false) {
if (($config?.features?.auth_trusted_header ?? false) || $config?.features?.auth === false) {
await signInHandler();
} else {
onboarding = $config?.onboarding ?? false;