OAuth Provider - Add Org/Team membership to userinfo endpoint #7751

Closed
opened 2025-11-02 07:35:26 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @bminer on GitHub (Aug 25, 2021).

  • Gitea version (or commit ref): 1.15.0
  • Git version: N/A
  • Operating system: Linux
  • Database (use [x]): N/A
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite

Description

When Gitea is acting as an OAuth provider, it would be nice if the /login/oauth/userinfo endpoint would return the orgs/teams to which a user is assigned if the "profile" scope is set. This would allow the client to parse this information and could possibly map it to a user group.

One implementation might add a new claim for each org, using the org name as the key for the claim. The claim would be an array of team names to which the user belonged for that org.

Another implementation would be to add a "teams" claim containing an array of [org_name]:[team_name] strings (where the org name and team name are concatenated together, separated by a colon or dash).

Thoughts on this? I am willing to submit a PR.

Originally created by @bminer on GitHub (Aug 25, 2021). - Gitea version (or commit ref): 1.15.0 - Git version: N/A - Operating system: Linux - Database (use `[x]`): N/A - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite ## Description When Gitea is acting as an OAuth provider, it would be nice if the `/login/oauth/userinfo` endpoint would return the orgs/teams to which a user is assigned if the "profile" scope is set. This would allow the client to parse this information and could possibly map it to a user group. One implementation might add a new claim for each org, using the org name as the key for the claim. The claim would be an array of team names to which the user belonged for that org. Another implementation would be to add a "teams" claim containing an array of `[org_name]:[team_name]` strings (where the org name and team name are concatenated together, separated by a colon or dash). Thoughts on this? I am willing to submit a PR.
GiteaMirror added the type/proposal label 2025-11-02 07:35:26 -06:00
Author
Owner

@thetechnick commented on GitHub (Oct 20, 2021):

Hey there!
I just revamped my home lab and use Gitea as OIDC provider for Harbor, having a group claim like with dex really comes in handy.
Created a small PR to add groups support. PTAL :)

@thetechnick commented on GitHub (Oct 20, 2021): Hey there! I just revamped my home lab and use Gitea as OIDC provider for Harbor, having a group claim like with dex really comes in handy. Created a small PR to add groups support. PTAL :)
Author
Owner

@lunny commented on GitHub (Nov 17, 2024):

Resolved by #17367

@lunny commented on GitHub (Nov 17, 2024): Resolved by #17367
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7751