Changelog — feat: typed AuthMode (2.0)
Branch:
next/2.0-authmodeVersion:1.1.4→2.0.0
Overview
Replaces the overlapping authentication-mode booleans (useCredentials / useSSO / useSAML) with
a single typed AuthMode discriminated union as the source of truth on globalConfig. See
docs/authentication/auth-mode.md for the full rationale and model.
Added
AuthModetype + constructors andAuthModeKind(src/configurations/auth-mode.ts), exported from the package root.globalConfig.authMode— the source of truth for the authentication method.detectAuthMode(config, preLogin?)— pure resolution of the mode from config + server pre-login (src/authentication/session/detect-auth-mode.ts), exported fromauthentication.- New tests:
detect-auth-mode.test.ts,configurations/tests/global-config.test.ts, and theunknown → SSO/credentialsresolution cases inlogin.test.ts.
Changed
login()rewritten to switch onauthMode. Theunknownmode now performs a real "try SSO, then fall back to credentials" resolution (the previous SSO-resolution block was dead code). On fallback it setsauthMode = credentialsso the login form is shown deterministically.initializeAppConfig()resolves the mode viadetectAuthMode(server providers still authoritative when the config defines none) and stores it inauthMode.appInitializerFnalias preserved.setGlobalConfig()now translates legacy boolean writes (useCredentials/useSSO/useSAML) into anauthMode; an explicitauthModewins.
Deprecated
globalConfig.useCredentials/useSSO/useSAMLare now read-only getters derived fromauthMode. Reads keep working; writes go throughsetGlobalConfig(translated). PreferauthMode.kindin new code.
Notes
- Provider/token inputs (
autoOAuthProvider,autoSAMLProvider,bearerToken) and impersonation (userOverride/userOverrideActive) are unchanged. - Behavioral parity: OAuth wins over SAML when both providers are present.
- Tests: full atomic suite green (273/273);
tsc --noEmitclean.