add changelog, documentation and fix groups list

Signed-off-by: Jan Larwig <jan@larwig.com>
This commit is contained in:
Jan Larwig 2025-08-19 08:29:38 +02:00
parent 11258ba612
commit 0ccabf4815
No known key found for this signature in database
GPG Key ID: C2172BFA220A037A
3 changed files with 27 additions and 16 deletions

View File

@ -14,6 +14,7 @@
- [#2273](https://github.com/oauth2-proxy/oauth2-proxy/pull/2273) feat: add Cidaas provider (@Bibob7, @Teko012) - [#2273](https://github.com/oauth2-proxy/oauth2-proxy/pull/2273) feat: add Cidaas provider (@Bibob7, @Teko012)
- [#3166](https://github.com/oauth2-proxy/oauth2-proxy/pull/3166) chore(dep): upgrade to latest golang 1.24.6 (@tuunit) - [#3166](https://github.com/oauth2-proxy/oauth2-proxy/pull/3166) chore(dep): upgrade to latest golang 1.24.6 (@tuunit)
- [#3156](https://github.com/oauth2-proxy/oauth2-proxy/pull/3156) feat: allow disable-keep-alives configuration for upstream (@jet-go) - [#3156](https://github.com/oauth2-proxy/oauth2-proxy/pull/3156) feat: allow disable-keep-alives configuration for upstream (@jet-go)
- [#3150](https://github.com/oauth2-proxy/oauth2-proxy/pull/3150) fix: Gitea team membership (@MagicRB, @tuunit)
# V7.11.0 # V7.11.0

View File

@ -1,10 +1,10 @@
--- ---
id: gitea id: gitea
title: Gitea title: Gitea / Forgejo
--- ---
:::note :::note
This is not actually its own provider. For more details and options please refer to the [GitHub Provider Options](github.md) This is not actually a fully serparate provider. For more details and options please refer to the [GitHub Provider Options](github.md)
::: :::
1. Create a new application: `https://< your gitea host >/user/settings/applications` 1. Create a new application: `https://< your gitea host >/user/settings/applications`

View File

@ -460,11 +460,14 @@ func (p *GitHubProvider) getOrgAndTeam(ctx context.Context, s *sessions.SessionS
} }
func (p *GitHubProvider) getOrgs(ctx context.Context, s *sessions.SessionState) error { func (p *GitHubProvider) getOrgs(ctx context.Context, s *sessions.SessionState) error {
// https://docs.github.com/en/rest/orgs/orgs#list-organizations-for-the-authenticated-user
type Organization struct { type Organization struct {
Login string `json:"login"` // Support for Github organizations
Name string `json:"name"` // https://docs.github.com/en/rest/orgs/orgs#list-organizations-for-the-authenticated-user
Login string `json:"login,omitempty"`
// Support for Gitea organizations
// https://docs.gitea.com/api/1.24/#tag/organization/operation/orgGetAll
Name string `json:"name,omitempty"`
} }
pn := 1 pn := 1
@ -491,11 +494,15 @@ func (p *GitHubProvider) getOrgs(ctx context.Context, s *sessions.SessionState)
} }
for _, org := range orgs { for _, org := range orgs {
orgName := org.Login var orgName string
if orgName == "" { if len(org.Login) > 0 {
orgName = org.Login
logger.Printf("Member of Github Organization: %q", orgName)
} else {
orgName = org.Name orgName = org.Name
logger.Printf("Member of Gitea Organization: %q", orgName)
} }
logger.Printf("Member of Github Organization:%q", orgName)
s.Groups = append(s.Groups, orgName) s.Groups = append(s.Groups, orgName)
} }
pn++ pn++
@ -511,7 +518,7 @@ func (p *GitHubProvider) getTeams(ctx context.Context, s *sessions.SessionState)
Slug string `json:"slug"` Slug string `json:"slug"`
Org struct { Org struct {
Login string `json:"login"` Login string `json:"login"`
Name string `json:"name"` Name string `json:"name"`
} `json:"organization"` } `json:"organization"`
} }
@ -539,16 +546,19 @@ func (p *GitHubProvider) getTeams(ctx context.Context, s *sessions.SessionState)
} }
for _, team := range teams { for _, team := range teams {
orgName := team.Org.Login var orgName, teamName string
if orgName == "" {
if len(team.Org.Login) > 0 {
orgName = team.Org.Login
teamName = team.Slug
logger.Printf("Member of Github Organization/Team: %q/%q", orgName, teamName)
} else {
orgName = team.Org.Name orgName = team.Org.Name
}
teamName := team.Slug
if teamName == "" {
teamName = team.Name teamName = team.Name
logger.Printf("Member of Gitea Organization/Team: %q/%q", orgName, teamName)
} }
logger.Printf("Member of Github Organization/Team:%q/%q", orgName, teamName)
s.Groups = append(s.Groups, fmt.Sprintf("%s%s%s", team.Org.Login, orgTeamSeparator, team.Slug)) s.Groups = append(s.Groups, fmt.Sprintf("%s%s%s", orgName, orgTeamSeparator, teamName))
} }
pn++ pn++