gitea/services
Zettat123 b1bfca39f1
Add `ExternalIDClaim` option for OAuth2 OIDC auth source (#37229)
This PR adds an External ID Claim Name configuration field to the OIDC
auth source. When set, Gitea uses the specified JWT claim as the user's
`ExternalID` instead of the default `sub` claim.

This PR fixes the bug when migrating from Azure AD V2 to OIDC. When an
admin migrates the same auth source to OIDC, goth's `openidConnect`
provider defaults to using the `sub` claim as `UserID`. However, Azure
AD's `sub` is a pairwise identifier:

> `sub`: The subject is a pairwise identifier and is unique to an
application ID. If a single user signs into two different apps using two
different client IDs, those apps receive two different values for the
subject claim.


https://learn.microsoft.com/en-us/entra/identity-platform/id-token-claims-reference#payload-claims

As a result, every existing user appears as a new account after
migration.

To fix this issue, Gitea should use `oid` claim for `UserID`.

> `oid`: This ID uniquely identifies the user across applications - two
different applications signing in the same user receives the same value
in the oid claim.

Note: The `oid` claim is not included in Azure AD tokens by default. The
`profile` scope must be added to the Scopes field of the auth source.
2026-04-16 17:30:46 +00:00
..
actions Remove error returns from crypto random helpers and callers (#37240) 2026-04-17 00:59:26 +08:00
agit Fix the wrong push commits in the pull request when force push (#36914) 2026-04-04 16:27:57 -07:00
asymkey Some refactors about GetMergeBase (#36186) 2026-01-17 11:22:09 -08:00
attachment Fix various problems (#37129) 2026-04-08 01:17:05 +08:00
auth Add `ExternalIDClaim` option for OAuth2 OIDC auth source (#37229) 2026-04-16 17:30:46 +00:00
automerge Fix issue label deletion with Actions tokens (#37013) 2026-03-29 09:21:14 +00:00
automergequeue
context Use Content-Security-Policy: script nonce (#37232) 2026-04-15 20:07:57 +00:00
contexttest Fix issue label deletion with Actions tokens (#37013) 2026-03-29 09:21:14 +00:00
convert Improve actions notifier for `workflow_run` (#37088) 2026-04-02 22:41:27 -07:00
cron Update Go dependencies (#36781) 2026-04-01 11:26:52 +08:00
doctor Remove unneeded doctor sub-commands (#37156) 2026-04-09 22:22:17 +02:00
externalaccount
feed Add comment for the design of "user activity time" (#37195) 2026-04-13 20:01:29 +00:00
forms Add `ExternalIDClaim` option for OAuth2 OIDC auth source (#37229) 2026-04-16 17:30:46 +00:00
git Fix bug when list pull request commits (#36485) 2026-01-30 18:46:34 +00:00
gitdiff Refactor "htmx" to "fetch action" (#37208) 2026-04-14 18:38:07 +00:00
indexer
issue Fix issue label deletion with Actions tokens (#37013) 2026-03-29 09:21:14 +00:00
lfs Fix issue label deletion with Actions tokens (#37013) 2026-03-29 09:21:14 +00:00
mailer Fix various problems (#37129) 2026-04-08 01:17:05 +08:00
markup Improve control char rendering and escape button styling (#37094) 2026-04-06 11:07:33 +00:00
migrations Update Go dependencies (#36781) 2026-04-01 11:26:52 +08:00
mirror Add migration http transport for push/sync mirror lfs (#36665) 2026-02-20 22:19:12 +00:00
notify
oauth2_provider Update tool dependencies and fix new lint issues (#36702) 2026-02-26 19:13:19 +00:00
org Refactor "org teams" page and help new users to "add member" to an org (#37051) 2026-03-31 21:30:25 +08:00
packages Add support for RPM Errata (updateinfo.xml) (#37125) 2026-04-08 00:39:53 +08:00
projects Refactor issue sidebar and fix various problems (#37045) 2026-03-31 10:03:52 +08:00
pull Add gpg signing for merge rebase and update by rebase (#36701) 2026-04-05 13:37:35 -07:00
release Update tool dependencies and fix new lint issues (#36702) 2026-02-26 19:13:19 +00:00
repository Fix issue label deletion with Actions tokens (#37013) 2026-03-29 09:21:14 +00:00
secrets
task
uinotification
user Fix org contact email not clearable once set (#36975) 2026-03-25 15:23:11 +08:00
versioned_migration
webhook Add webhook name field to improve webhook identification (#37025) (#37040) 2026-04-01 09:56:20 +08:00
webtheme Merge some standalone Vite entries into index.js (#37085) 2026-04-05 19:13:34 +00:00
wiki Fix URLJoin, markup render link reoslving, sign-in/up/linkaccount page common data (#36861) 2026-03-08 15:57:37 +00:00