Skip to content
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

Allow preferred_username as username source for OIDC #30454

Conversation

SimonErm
Copy link
Contributor

This PR adds the preferred_username claim as a possible username source for the oauth2_client.

Closes #21518

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 13, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 13, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Apr 13, 2024
@pull-request-size pull-request-size bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 13, 2024
@delvh delvh changed the title Feature/add OIDC preferred_username as username source Allow preferred_username as username source for OIDC Apr 14, 2024
routers/web/auth/auth.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 15, 2024
@SimonErm SimonErm force-pushed the feature/add-oidc-preferred_username-as-username-source branch from 03d0768 to 8e846e2 Compare April 15, 2024 15:34
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 15, 2024
@delvh delvh added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 15, 2024
@lunny lunny enabled auto-merge (squash) April 16, 2024 05:14
@lunny lunny merged commit 6ba0c37 into go-gitea:main Apr 16, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone Apr 16, 2024
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 16, 2024
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 17, 2024
* giteaofficial/main:
  Reduce unnecessary database queries on actions table (go-gitea#30509)
  [skip ci] Updated translations via Crowdin
  Tweak and fix toggle checkboxes (go-gitea#30527)
  Tweak repo buttons on mobile and labeled button border-radius (go-gitea#30503)
  Fix long branch name overflows (go-gitea#30345)
  Update API to return 'source_id' for users (go-gitea#29718)
  Allow `preferred_username` as username source for OIDC (go-gitea#30454)
  Fix empty field `login_name` in API response JSON when creating user (go-gitea#30511)
  feat(api): implement branch/commit comparison API (go-gitea#30349)
wxiaoguang added a commit to wxiaoguang/gitea that referenced this pull request Apr 21, 2024
wxiaoguang added a commit to wxiaoguang/gitea that referenced this pull request Apr 21, 2024
wxiaoguang added a commit to wxiaoguang/gitea that referenced this pull request Apr 21, 2024
wxiaoguang added a commit to wxiaoguang/gitea that referenced this pull request Apr 21, 2024
wxiaoguang added a commit to wxiaoguang/gitea that referenced this pull request Apr 23, 2024
wxiaoguang added a commit to wxiaoguang/gitea that referenced this pull request Apr 23, 2024
wxiaoguang added a commit to wxiaoguang/gitea that referenced this pull request Apr 23, 2024
wxiaoguang added a commit that referenced this pull request Apr 25, 2024
…handling (#30622)

Follow #30454
And fix #24957

When using "preferred_username", if no such field,
`extractUserNameFromOAuth2` (old `getUserName`) shouldn't return an
error. All other USERNAME options do not return such error.

And fine tune some logic and error messages, make code more stable and
more friendly to end users.
@wxiaoguang wxiaoguang modified the milestones: 1.23.0, 1.22.0 Apr 27, 2024
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jul 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/docs modifies/go Pull requests that update Go code size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OIDC auth: Allow the source field of username to be configurable instead of fixed to sub
5 participants