feat(proxy): /login, /logout, auth_mode="optional" (home#118 phase 2) #25
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_proxy!25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat_118_login_logout_optional"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 2 of home#118 — the hero_proxy-side primitives that unblock guest-first mode for hero_os.
Summary
GET /login?next=<path>[&provider=<name>]— picks an OAuth provider (explicit?provider=or first enabled), stashes CSRF state + sanitized return-to, redirects to the provider's auth URL.GET /logout?next=<path>— deletes the session row, clears the session cookie, redirects.auth_mode="optional"— forwardsX-Hero-User/X-Hero-Context/X-Hero-Claimswhen a valid session exists, forwards as guest otherwise (no redirect). IP-based identity still applies in the guest branch.?next=is constrained to same-origin relative paths (open-redirect guard)./loginand/logoutbypass bearer auth in the middleware — they are browser-initiated."oauth"branch to share anapply_oauth_sessionhelper with"optional".Phase 1 (hero_os guest mode) and Phase 3 (hero_auth as an OIDC provider) will land as separate PRs in their own repos.
Test plan
cargo test -p hero_proxy_server— 17 passed (4 new)cargo clippy -p hero_proxy_server --all-targets -- -D warnings— cleanDomainRouteforhero_oswithauth_mode="optional", hit it with no session → guest; hit/login→ OAuth; callback → redirect tonext; hit/logout→ cookie cleared.Closes none (parent issue home#118 stays open until all phases ship).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.