Repository navigation
auth.login_path: let a site serve its own login page (#159) - #160
Merged
Merged
Conversation
Gating redirects, a failed password login and the magic-link error page use the configured path; GET /auth/login redirects to it with the query kept. The path is validated as a local absolute path, and the page served there is exempt from default_roles/inherited gating so a gated site cannot loop. Fixes #159 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…login pages Every mounted site registers its login path (the default included) so the single-entry fallback cannot hand one site another's path. A trailing slash is normalized for redirects and the default_roles exemption. Translations of the login page (same folder) are exempt too. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #159
site.yaml:auth.login_path: /join(default/auth/login).login_pathwith?next=: the page gate, a logged-out visitor opening a gated file (mediaDenialResponse), a failed password login (?error=invalid), and the "Try again" link on the magic-link error page.GET /auth/loginredirects tologin_path(query kept), so there is one login page. Not redirected whenlogin_pathis unset or/auth/login, so no loop./auth/*:POST /auth/login, OAuth callbacks, magic-link send/verify, logout. The custom page posts to them.login_pathmust be a local absolute path: one leading/, plain path characters, no//host, URL, query, fragment or... Config validation rejects anything else; at runtime an invalid value falls back to/auth/login.login_pathis treated asroles: publicby the inheritance pass, so neitherauth.default_rolesnor a gated ancestor can gate it. Its ownroles:still applies.How it is wired: gating has no config access, so
mountDuneAuthregisters the path per origin (setGatingLoginPath, same pattern assetGatingAuthz) andenforceRolesreads it withloginPathForRequest(req).Not in this PR
login_path, after the release (dune-docs#30 is held until then).logintemplate and the OAuth buttons are untouched; a custom page links to/auth/{provider}itself.Testing
8 new tests (
tests/auth/login_path_test.ts): path validation, config validation, gate and media redirects including per-origin selection, the default-roles exemption (and the loop it prevents),GET /auth/loginredirect with query, no redirect when unset or equal to/auth/login, password failure redirect, magic-link error link.tests/auth,config,content,runtime: 625 pass;deno checkanddeno lint srcclean. Not exercised in a browser.Based on main after #158.
🤖 Generated with Claude Code