forgejo/modules/validation
hwipl 1ea5605eae feat: add dynamic group mappings for OIDC (#11656)
Currently, Forgejo supports configuring static group team mappings for
an OIDC authentication source that map OIDC groups to Forgejo
organizations and teams. For example, the following mapping

```json
{"Developer": {"MyForgejoOrganization": ["MyForgejoTeam1", "MyForgejoTeam2"]}}
```

automatically adds a user in the OIDC group `Developer` to the teams
`MyForgejoTeam1` and `MyForgejoTeam2` in organization
`MyForgejoOrganization`.

In order to support more dynamic mappings and to avoid having to update
the mappings for new organizations and teams, add an additional
configuration option that supports mappings with placeholders like in
the following example:

```json
["group-{org}-{team}", "other:{org}/{team}"]
```

In this example, the mappings add a user in OIDC groups
`group-org1-team1`, `group-org2-team2`, and `other:org3/team3` to team
`team1` in organization `org1`, team `team2` in organization `org2`, and
to team `team3` in organization `org3`.

Additionally, this adds a configuration option to dynamically remove
users from organization teams. If enabled, a user is removed from all
teams that are not added via a static or dynamic mapping. Thus, users
are only in teams that are added via such a mapping and no other teams.

Docs: forgejo/docs!1950

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11656
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-05-22 12:38:20 +02:00
..
binding.go feat: add dynamic group mappings for OIDC (#11656) 2026-05-22 12:38:20 +02:00
binding_test.go Validate OAuth Redirect URIs (#32643) 2024-12-03 10:19:22 +01:00
email.go chore: add email blocklist unit test 2025-08-30 09:45:19 +02:00
email_test.go chore: add email blocklist unit test 2025-08-30 09:45:19 +02:00
glob_pattern_test.go [CHORE] Use forked binding library 2024-11-05 22:47:34 +01:00
helpers.go chore: add modernizer linter (#11936) 2026-04-02 03:29:37 +02:00
helpers_test.go feat(activitypub): use structure @PreferredUsername@host.tld:port for actors (#9254) 2026-01-30 23:45:11 +01:00
refname_test.go [CHORE] Use forked binding library 2024-11-05 22:47:34 +01:00
regex_pattern_test.go [CHORE] Use forked binding library 2024-11-05 22:47:34 +01:00
validatable.go chore: update github.com/go-ap/activitypub to 902f6cf (#11301) 2026-04-02 23:57:13 +02:00
validatable_test.go enhance validateable interface (#7714) 2025-05-30 13:07:35 +02:00
validurl_test.go [CHORE] Use forked binding library 2024-11-05 22:47:34 +01:00
validurllist_test.go Validate OAuth Redirect URIs (#32643) 2024-12-03 10:19:22 +01:00