Skip to content

Support OIDC RP-initiated logout#30072

Closed
jlehtoranta wants to merge 20 commits intogo-gitea:mainfrom
jlehtoranta:oidc_rp-initiated-logout
Closed

Support OIDC RP-initiated logout#30072
jlehtoranta wants to merge 20 commits intogo-gitea:mainfrom
jlehtoranta:oidc_rp-initiated-logout

Conversation

@jlehtoranta
Copy link
Copy Markdown

Add support for OIDC RP-initiated logout as defined in https://openid.net/specs/openid-connect-rpinitiated-1_0.html:

  • Track OIDC/OAuth2 login type, tokens and authentication data on session level
  • Keep session level data synced when using a login cookie (remember option)
  • Handle OIDC/OAuth2 logouts on an authentication source specific endpoint
  • Redirect to the OIDC end_session_endpoint, if it exists in the provider configuration
  • Fallback to local logout only
  • Be verbose about external logout errors
  • Use a callback endpoint for maintaining state between Gitea and an OIDC provider

Fixes #14270


Additional notes:

  • Tested with Keycloak (OIDC) and Github (OAuth2). Thorough testing with other IdPs and server setups is needed
  • There are most likely some (small) merge conflicts with Support SAML authentication #29403 as these PRs modify partly the same code
  • An additional PR is required for supporting OIDC back-channel (or front-channel) logout. I.e. your session in Gitea will still remain logged in, if you logout from your IdP elsewhere
  • Tracking external logins on session level by using ExternalAuthTokens makes it easier to implement OIDC back-channel or front-channel logout support in the future

Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
…ions

Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
…lumns

Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
…ount

Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
Signed-off-by: Jarkko Lehtoranta <jarkko@bytecap.fi>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 25, 2024
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/migrations labels Mar 25, 2024
@lunny lunny added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Apr 10, 2024
@lunny
Copy link
Copy Markdown
Member

lunny commented Apr 10, 2024

Since it's a big change for the user system, I think we need more time to discuss and have a whole design about the user system.

@jon-nfc
Copy link
Copy Markdown

jon-nfc commented Jun 30, 2025

Track OIDC/OAuth2 login type, tokens and authentication data on session level

if this tracking of "tokens" is the current method i.e. storing in the db, this is a major security issue (more than major if that's even possible). please take a look at the following posts I have just made after discovering this major issue which includes why it's bad and why it needs to be fixed as a matter of priority:

@Fuseteam
Copy link
Copy Markdown

what is the blocker for this?

@wxiaoguang
Copy link
Copy Markdown
Contributor

Stale for long time, and a lot of conflicts.

Please take a look at the new PR Implements OIDC RP-Initiated Logout #36724

@wxiaoguang wxiaoguang closed this Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/go Pull requests that update Go code modifies/migrations type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logging out of OpenID Connect provider

7 participants