Convert errors from django_openid_auth to django-oauth-toolkit with login.ubuntu.com OIDC SSO#14
Draft
Convert errors from django_openid_auth to django-oauth-toolkit with login.ubuntu.com OIDC SSO#14
errors from django_openid_auth to django-oauth-toolkit with login.ubuntu.com OIDC SSO#14Conversation
Co-authored-by: Hyask <[email protected]>
…T version Co-authored-by: Hyask <[email protected]>
Copilot
AI
changed the title
[WIP] Convert errors to use django-oauth-toolkit
Convert Mar 3, 2026
errors from django_openid_auth to django-oauth-toolkit
Collaborator
|
@copilot the new workflow should still rely on the SSO provided by login.ubuntu.com, as before. |
Add custom OIDC client views (oidc_login, oidc_callback) that redirect users to login.ubuntu.com for authentication via OpenID Connect, replacing the deprecated OpenID 2.0 flow from django_openid_auth. The OIDC client flow: 1. User clicks "Log in" → /oidc/login/ 2. Redirect to login.ubuntu.com OIDC authorize endpoint 3. User authenticates at login.ubuntu.com 4. Callback at /oidc/callback/ exchanges code for tokens 5. Userinfo endpoint provides user details and group memberships 6. Django user created/updated, Launchpad teams mapped to groups Configuration (via local_config.py): - oidc_client_id / oidc_client_secret: OAuth2 client credentials - oidc_authorize_url / oidc_token_url / oidc_userinfo_url: OIDC endpoints Co-authored-by: Hyask <[email protected]>
…ation to OIDC views Co-authored-by: Hyask <[email protected]>
Contributor
Author
Reworked in f851b5f. The authentication flow now uses login.ubuntu.com as the OIDC provider:
OIDC endpoint URLs default to |
Copilot
AI
changed the title
Convert
Convert Mar 3, 2026
errors from django_openid_auth to django-oauth-toolkiterrors from django_openid_auth to django-oauth-toolkit with login.ubuntu.com OIDC SSO
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.
django_openid_authis deprecated. Replace it withdjango-oauth-toolkit(DOT) and custom OIDC client views that authenticate users via login.ubuntu.com using OpenID Connect instead of OpenID 2.0.Changes
oidc.py: OIDC client views (oidc_login,oidc_callback) implementing the authorization code flow with login.ubuntu.com — redirects users to login.ubuntu.com for authentication, exchanges authorization codes for tokens, fetches userinfo, creates/updates Django users, and maps Launchpad teams to Django groupssettings.py:OpenIDBackend→OAuth2Backend,oauth2_providerinINSTALLED_APPS, allOPENID_*settings replaced with OIDC client configuration (OIDC_AUTHORIZE_URL,OIDC_TOKEN_URL,OIDC_USERINFO_URL,OIDC_CLIENT_ID,OIDC_CLIENT_SECRET,OIDC_CALLBACK_URL), preserved Launchpad teams mapping asOIDC_LAUNCHPAD_TEAMS_MAPPING,LOGIN_URL→/oidc/login/urls.py: Added/oidc/login/and/oidc/callback/routes for the OIDC client flow, DOT provider URLs mounted at/o/config.py:openid_trust_root→ OIDC client settings (oidc_authorize_url,oidc_token_url,oidc_userinfo_url,oidc_client_id,oidc_client_secret) with defaults pointing to login.ubuntu.comindex.html: Preserved login.ubuntu.com profile link (unchanged from original)pyproject.toml: Addeddjango-oauth-toolkit>=3.0.0to dev depsUnchanged
auth.pygroup-based authorization (@can_see_stacktraces) — uses Django groups, backend-agnosticlogout_view/login_failedviewscontext_processors.py— builds login URL fromsettings.LOGIN_URLDeployment note
Operators must set
oidc_client_idandoidc_client_secretinlocal_config.pywith valid OAuth2 client credentials registered with login.ubuntu.com. The OIDC endpoint URLs default tologin.ubuntu.com/+openid-connect/*and can be overridden if needed.Original prompt
errorsto usingdjango-oauth-toolkit#13✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.