Skip to content

feat: expose OIDC end-session endpoint - #1102

Draft
norrs wants to merge 15 commits into
tinyauthapp:mainfrom
norrs:feat/oidc-end-session
Draft

feat: expose OIDC end-session endpoint#1102
norrs wants to merge 15 commits into
tinyauthapp:mainfrom
norrs:feat/oidc-end-session

Conversation

@norrs

@norrs norrs commented Aug 30, 2026

Copy link
Copy Markdown

Stack

This PR depends on #1094 and must merge after it. Because the branches are on a fork, GitHub requires this PR to target main; its Files view will include the parent until #1094 merges. Review the endpoint-only change here:

norrs/tinyauth@feat/sso-logout...feat/oidc-end-session

Summary

  • advertise end_session_endpoint in OIDC discovery
  • validate downstream ID token hints and registered post-logout redirect URIs
  • reuse the upstream provider logout cascade for OIDC clients
  • protect provider callbacks with short-lived, one-time tickets
  • cover the endpoint, validation, redirects, discovery metadata, and logout cascade

Verification

  • make test
  • make vet
  • go test -count=1 ./internal/controller ./internal/service

norrs and others added 15 commits August 25, 2026 00:33
OAuth-backed sessions currently only log out of Tinyauth. When the
upstream provider keeps its SSO session, the next protected application
access can immediately create a new Tinyauth session, so logout does not
behave like an end-to-end sign-out for OIDC providers that support
RP-initiated logout.

Add an optional OAuth provider logoutUrl for the OpenID Provider
end_session_endpoint and keep the provider id_token server-side on the
Tinyauth session. The logout handler now deletes the local session,
builds the OP logout request with client_id, id_token_hint,
post_logout_redirect_uri, and state, and returns that redirect to the
frontend. The callback endpoint validates and restores the requested
application return URL after the OP hop.

Persist oauth_id_token for SQLite, Postgres, memory, SQLC generated
repositories, and store wrapper models so refreshed sessions retain the
token. Add migrations for both database drivers. Update the logout page
and quick actions menu to follow backend-provided redirect URLs while
keeping Tinyauth redirect_uri separate from OIDC
post_logout_redirect_uri.

Cover the new behavior with controller tests for safe logout redirects,
logout URL construction, and use of the server-side id_token. Enable TLS
on the dev whoami route so the local Traefik setup exercises the
secure-cookie and OIDC logout flow.

Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment)

Spec: OpenID Connect RP-Initiated Logout 1.0 end_session_endpoint MUST use https.

Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment)

Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment)

Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment)

Refs: tinyauthapp#1094 (comment)

Co-Authored-By: OpenAI Codex <codex@openai.com>
Refs: tinyauthapp#1094 (comment)

Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>
Advertise RP-initiated logout in discovery, validate downstream ID token hints and registered post-logout redirects, and reuse the upstream logout cascade with one-time callback tickets.

Co-Authored-By: OpenAI Codex <codex@openai.com>
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant