Skip to content

feat(sso): add tests for linkable existing user and enhance linking l… - #102

Merged
jaymesC merged 11 commits into
mainfrom
sso-link-passwordless-invited
Sep 1, 2026
Merged

feat(sso): add tests for linkable existing user and enhance linking l…#102
jaymesC merged 11 commits into
mainfrom
sso-link-passwordless-invited

Conversation

@jaymesC

@jaymesC jaymesC commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

What

Four SSO sign-in changes:
(1) link SSO to invited-but-unactivated accounts,
(2) fire AfterSignIn for SSO logins,
(3) SSO enforcement ("Require SSO"),
(4) identifier-first SSO discovery in the shared SignInForm.

Why

(1) The link guard refused any unverified pre-existing account, breaking "admin invites → user signs in via SSO" — every invited user hit auth_failed.
(2) SSO logins go through IssueSession, which never emitted AfterSignIn, so audit/plugin hooks missed them.
(3) Enterprises mandating SSO had no way to block password fallback for their domain.
(4) The form was already email→password two-step; only home-realm discovery was missing to match Okta/MS/Google.

How

(1) In linkableExistingUser, unverified + no password → link & mark verified (IdP proves email control); has password → keep refusing (takeover vector).
(2) Emit EmitAfterSignIn in authenticateUser after the session is issued.
(3) New enforced column (migration add_enforced) + OnBeforeSignIn veto of password login for an enforced domain, with owner/admin bypass.
(4) New resolveSSO?(email) prop + SSOResolution on SignInForm: enforced → straight to IdP, optional → SSO + password, no-SSO/error → password (fails open).
Tests

link_test.go, matching_test.go, enforce_test.go, sign-in-form.sso.test.tsx (+ existing sign-in tests). Go + ui-components build/lint/suite green.

@jaymesC
jaymesC requested a review from juicycleff August 29, 2026 18:16
@jaymesC
jaymesC merged commit 4eda823 into main Sep 1, 2026
17 checks passed
@juicycleff
juicycleff deleted the sso-link-passwordless-invited branch September 2, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants