This repository was archived by the owner on Oct 28, 2026. It is now read-only.
Repository navigation
Make single sign-on able to stand alone, and fix Authentik account linking - #32
Merged
Merged
Conversation
…king Three things, all consequences of single sign-on becoming the primary way in rather than an alternative to the password form. **Password sign-in can be switched off.** A new toggle on the sign-in settings screen, so an install with SSO working can insist on it. Refused at the authentication callback rather than only hidden on the page — a form that is not rendered is not a closed door. Three things stop it being a way to lock yourself out: it cannot be switched off until SSO is usable, it stops applying by itself if SSO is later disabled or left half-configured, and CONSOLE_FORCE_PASSWORD_LOGIN=true in the environment puts the form back for someone with a shell on the box, which is the position you are in on the day the provider is what broke. **Authentik could never link an existing account.** Two causes, both fixed. `email_verified` is optional in the spec and Authentik does not send it, but the claim was read with filter_var, which cannot tell "said no" from "said nothing": every provider that omits it looked like one refusing to vouch for the address. The claim is now read as the three states it really has, and a new setting — "Trust email addresses the provider does not mark as verified", on by default — governs the absent case. An explicit `email_verified: false` is still refused whatever it is set to; that is the provider answering, and the answer stands. Userinfo was also only consulted when the *groups* claim was missing, so a token carrying groups but no email details was never topped up. Authentik's default configuration puts a minimal set of claims in the ID token and the rest behind userinfo, so the test is now per claim: anything the flow needs and the token lacks is fetched once. **TOTP is no longer demanded of accounts the provider alone lets in.** Those accounts have no password, so the provider is the sole gate and the second factor is the provider's to enforce. An account that keeps a password alongside SSO is not exempt, because that password is a way in the provider never sees. Enrolment stays available to everyone: our password-confirmation middleware lets a passwordless account through, since Fortify's gate was otherwise a dead end for the two-factor screen the account menu offers to all. Also: the sign-in page showed the OIDC failure twice, once from the layout's error summary and once from a block of its own. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QjX5f2ZtAKYfiQmzWaD8tp
|
Warning Review limit reachedNext included review available in 9 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (19)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #31, from using it against a real Authentik instance. Three changes, all consequences of single sign-on becoming the primary way in rather than an alternative to the password form.
Password sign-in can be switched off
A new toggle on
/settings/authentication, so an install with SSO working can insist on it.Refused at the authentication callback rather than only hidden on the sign-in page — a form that is not rendered is not a closed door. Three things stop it being a way to lock yourself out of a console that deploys to production:
CONSOLE_FORCE_PASSWORD_LOGIN=truein the environment puts the form back for someone with a shell on the box — which is the position you are in on the day the provider is what broke, when the setting that would fix it is behind the sign-in page it is blocking.The settings screen says which of those is in force when the checkbox and reality disagree.
Authentik could never link an existing account
The reported symptom was every sign-in ending in "The identity provider did not confirm your email address, so it cannot be linked to an existing account here." Two causes, both fixed.
email_verifiedread as two states instead of three. The claim is optional in the spec and Authentik does not send it, but it was read withfilter_var(..., FILTER_VALIDATE_BOOLEAN), which cannot tell "said no" from "said nothing" — so every provider that omits it looked like one refusing to vouch for the address, and linking could never succeed. It is now read as the three states it really has, and a new setting — Trust email addresses the provider does not mark as verified, on by default — governs the absent case. An explicitemail_verified: falseis still refused whatever it is set to: that is the provider answering, and the answer stands. The two failures now also say which one happened, so the fix is one setting rather than a hunt through logs.Userinfo was only consulted when the groups claim was missing. Authentik's default configuration puts a minimal set of claims in the ID token and the rest behind userinfo, so a token carrying groups but no email details was never topped up. The test is now per claim: anything the flow needs and the token lacks is fetched once, with the same
submatch as before.TOTP is no longer demanded of accounts the provider alone lets in
An account whose only way in is the provider has no password, so the provider is the sole gate and the second factor is the provider's to enforce. MFA enforcement for those accounts now lives entirely at the IdP — that is the trade this makes, and it is worth being explicit about.
An account that keeps a password alongside SSO is not exempt and must still enrol, because that password is a way in the provider never sees, so whatever MFA the provider enforces is not on that path.
Enrolment stays available to everyone, exempt or not. That needed a fix of its own: Fortify puts TOTP enrolment behind password confirmation, and a passwordless account has nothing to confirm — so the two-factor screen the account menu offers to all was a dead end for exactly the accounts SSO creates.
App\Http\Middleware\ConfirmPasswordlets an account with no password through and leaves every other account's confirmation unchanged.Also
The sign-in page showed an OIDC failure twice — once from the guest layout's error summary and once from a block of its own.
Testing
318 tests pass (11 new),
pint --testclean,npm run buildclean. New coverage: password sign-in off and refused at the endpoint, the two lock-out guards and the environment override, a provider that sends noemail_verifiedat all (both trust settings), an explicitfalserefused regardless, claims read from userinfo when the token omits them, the TOTP exemption and its password-holding boundary.🤖 Generated with Claude Code
https://claude.ai/code/session_01QjX5f2ZtAKYfiQmzWaD8tp
Generated by Claude Code