Changelog — feat: OIDC server-side auto-authentication (unknown login branch)
Branch:
feat/oidc-auto-authentication
Overview
When no authentication provider is declared (authMode resolves to unknown) and there is no local
session, the server may still auto-authenticate the user — typically an OIDC reverse proxy that has a
valid IdP session and injects the identity (e.g. OIDC_CLAIM_upn). Previously login() fell straight
through to the credentials form in this case. It now probes for server-side auto-authentication first.
Added
tryAutoAuthentication()(src/authentication/session/try-auto-authentication.ts) — probes a protected endpoint (api/v1/principal?action=get) withoutnoAutoAuthenticationand withoutsuppressErrors, inredirect: "manual", so the server is allowed to run its auto-auth challenge. Returnstrueon200(auto-authenticated),falseon 401 / redirect / timeout / network error. Never throws. Distinct fromgetCsrfToken(suppresses the challenge) andfetchPrincipal(disables auto-auth vianoAutoAuthentication=true).
Changed
login()— theunknownbranch now callstryAutoAuthentication()before falling back to the credentials form. A200is authoritative on its own: the session is established (typically via an HttpOnly cookie), so the user is authenticated (authMode = sso) even when no token is available client-side. The subsequentgetCsrfToken()is a best-effort refresh (.catch(() => {})): it primesgetToken()where the challenge endpoint is available, but its failure no longer blocks an already-established session — the priortry/catchgate fell back to credentials whenever the token could not be confirmed, which broke proxy SSO setups that return no token via header or challenge.
Tests
login.test.ts— auto-auth probe success authenticates assso; stays authenticated when the CSRF refresh fails (proxy SSO / cookie-only); server-not-auto-authenticating still falls back to credentials. 17 passed.
Notes
- The companion
atomic-angularchange (withCredentialson the HttpClient path + SSO re-probe before reload) ensures the cookie established here is sent on every subsequent request and that a later 401 does not loop on reload. Seeatomic-angularbranchfix/logout-signed-out-view.