summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-01-31 21:36:34 +0000
committerGitHub <noreply@github.com>2022-01-31 23:36:34 +0200
commit083b85c655c243d63754a13c29eb7d3a3db1fa87 (patch)
tree3f5ce711828d9aa327977b15567f55fb202ec0e0 /routers
parentd5027b6c0977cab63d77c9ec97ea0df4426000c1 (diff)
downloadgitea-083b85c655c243d63754a13c29eb7d3a3db1fa87.tar.gz
gitea-083b85c655c243d63754a13c29eb7d3a3db1fa87.zip
Fix OAuth Source Edit Page (#18495) (#18503)
Backport #18495 * Fix OAuth Source Edit Page to ensure restricted and group settings are set * Also tolerate []interface in the groups Fix #18432 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers')
-rw-r--r--routers/web/admin/auths.go3
-rw-r--r--routers/web/auth/oauth.go4
2 files changed, 7 insertions, 0 deletions
diff --git a/routers/web/admin/auths.go b/routers/web/admin/auths.go
index 338a54c5dd..20f364739e 100644
--- a/routers/web/admin/auths.go
+++ b/routers/web/admin/auths.go
@@ -192,6 +192,9 @@ func parseOAuth2Config(form forms.AuthenticationForm) *oauth2.Source {
RequiredClaimName: form.Oauth2RequiredClaimName,
RequiredClaimValue: form.Oauth2RequiredClaimValue,
SkipLocalTwoFA: form.SkipLocalTwoFA,
+ GroupClaimName: form.Oauth2GroupClaimName,
+ RestrictedGroup: form.Oauth2RestrictedGroup,
+ AdminGroup: form.Oauth2AdminGroup,
}
}
diff --git a/routers/web/auth/oauth.go b/routers/web/auth/oauth.go
index fa2b0aa65f..dbd1756348 100644
--- a/routers/web/auth/oauth.go
+++ b/routers/web/auth/oauth.go
@@ -904,6 +904,10 @@ func claimValueToStringSlice(claimValue interface{}) []string {
switch rawGroup := claimValue.(type) {
case []string:
groups = rawGroup
+ case []interface{}:
+ for _, group := range rawGroup {
+ groups = append(groups, fmt.Sprintf("%s", group))
+ }
default:
str := fmt.Sprintf("%s", rawGroup)
groups = strings.Split(str, ",")