forked from matrix-construct/tuwunel
-
Notifications
You must be signed in to change notification settings - Fork 0
Add OAuth 2.0 / OIDC Authentication Support with MSC3861 Native Integration #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Copilot
wants to merge
25
commits into
main
Choose a base branch
from
copilot/add-oauth2-0-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Copilot
AI
changed the title
[WIP] Add complete support for OAuth 2.0
Add OAuth 2.0 / OIDC Authentication Support
Oct 12, 2025
Copilot finished work on behalf of
stevessr
October 12, 2025 14:27
Owner
|
@copilot 对照MSC3861进一步完善oauth2.0登陆流程! |
Author
已根据 MSC3861 完善了 OAuth 2.0 登录流程: 新增 MSC3861 功能:
已完成的路由集成:
配置示例见 Commit: 提交中... |
Copilot
AI
changed the title
Add OAuth 2.0 / OIDC Authentication Support
Add OAuth 2.0 / OIDC Authentication Support with MSC3861 Native Integration
Oct 13, 2025
Copilot finished work on behalf of
stevessr
October 13, 2025 01:27
dca33e7 to
e65b1eb
Compare
e65b1eb to
e715e22
Compare
e715e22 to
c9e8aba
Compare
Co-authored-by: stevessr <[email protected]>
Co-authored-by: stevessr <[email protected]>
Co-authored-by: stevessr <[email protected]>
Co-authored-by: stevessr <[email protected]>
Co-authored-by: stevessr <[email protected]>
Co-authored-by: stevessr <[email protected]>
Co-authored-by: stevessr <[email protected]>
- Add MSC3861 configuration options (account_management_url, experimental_msc3861) - Implement MSC3861 account management endpoint - Enhance OIDC discovery with account management capabilities - Update .well-known/matrix/client with OAuth authentication info (MSC2965/MSC3861) - Add MSC2965 OAuth issuer discovery endpoint to router - Add MSC3861 account management endpoint to router - Add OIDC discovery endpoint to router - Update documentation with MSC3861 features and configuration - Update implementation status to reflect completed features Co-authored-by: stevessr <[email protected]>
Co-authored-by: stevessr <[email protected]>
Co-authored-by: stevessr <[email protected]>
This reverts commit 3e63307.
4254602 to
7de710b
Compare
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.
Overview
This PR implements comprehensive OAuth 2.0 and OpenID Connect (OIDC) authentication support for Tuwunel, enabling users to log in using external identity providers such as Google, Keycloak, Auth0, Okta, Microsoft Entra ID, GitLab, and any other OIDC-compliant provider.
New: Includes full MSC2965 and MSC3861 support for native Matrix + OIDC integration with account management capabilities.
Changes
Core Implementation
Configuration System (
src/core/config/mod.rs)OAuthConfigstruct with complete OAuth/OIDC configuration optionsaccount_management_urlandexperimental_msc3861configuration optionsOAuth Module (
src/api/client/session/oauth.rs)OIDC Discovery (
src/api/client/oidc.rs).well-known/openid-configuration/_matrix/client/unstable/org.matrix.msc2965/auth_issuer)/_matrix/client/unstable/org.matrix.msc3861/account_management)Session Integration (
src/api/client/session/mod.rs)m.login.ssologin type when OAuth is enabledRouter Integration (
src/api/router.rs)GET /_matrix/client/v3/login/sso/redirectGET /_matrix/client/v3/login/sso/callbackGET /_matrix/client/unstable/org.matrix.msc2965/auth_issuerGET /_matrix/client/unstable/org.matrix.msc3861/account_managementGET /.well-known/openid-configurationWell-Known Enhancement (
src/api/client/well_known.rs)/.well-known/matrix/clientwith OAuth authentication informationorg.matrix.msc2965.authenticationfield when MSC3861 is enabledDocumentation
Added comprehensive documentation covering:
docs/oauth.md) - Complete configuration walkthrough with MSC3861 section, security best practices, and troubleshootingdocs/msc3861-implementation.md) - Technical details of MSC3861 native OIDC integrationdocs/configuration/oauth-examples.md) - Ready-to-use configurations for Google, Keycloak, Authentik, Auth0, Okta, Microsoft Entra ID, and GitLabdocs/oauth-status.md) - Feature tracking, known limitations, and future enhancementsOAUTH_IMPLEMENTATION.md) - Implementation details and next stepsUsage Example
Basic OAuth Configuration
MSC3861 Native OIDC Integration
Authentication Flow
GET /_matrix/client/v3/loginm.login.ssowhen OAuth is enabled.well-known/matrix/client/_matrix/client/v3/login/sso/redirectwith optional redirect URL/_matrix/client/v3/login/sso/callbackwith authorization codeMSC3861 Features
Account Management
org.matrix.profile,org.matrix.sessions_list,org.matrix.session_view,org.matrix.session_endEnhanced Discovery
.well-known/matrix/clientincludes OAuth authentication issuer (MSC2965)Endpoints
GET /_matrix/client/v3/login/sso/redirectGET /_matrix/client/v3/login/sso/callbackGET /_matrix/client/unstable/org.matrix.msc2965/auth_issuerGET /_matrix/client/unstable/org.matrix.msc3861/account_managementGET /.well-known/openid-configurationGET /.well-known/matrix/clientSecurity Considerations
Compatibility
Benefits
For Users
For Administrators
For Developers
Implementation Status
✅ Completed
🚧 Future Enhancements
Testing
Statistics
References
Resolves the request to add OAuth 2.0 完整支持 (complete OAuth 2.0 support) with MSC3861 native OIDC integration.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.