Skip to content

Commit 083b85c

Browse files
authored
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 <[email protected]>
1 parent d5027b6 commit 083b85c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

routers/web/admin/auths.go

+3
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ func parseOAuth2Config(form forms.AuthenticationForm) *oauth2.Source {
192192
RequiredClaimName: form.Oauth2RequiredClaimName,
193193
RequiredClaimValue: form.Oauth2RequiredClaimValue,
194194
SkipLocalTwoFA: form.SkipLocalTwoFA,
195+
GroupClaimName: form.Oauth2GroupClaimName,
196+
RestrictedGroup: form.Oauth2RestrictedGroup,
197+
AdminGroup: form.Oauth2AdminGroup,
195198
}
196199
}
197200

routers/web/auth/oauth.go

+4
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,10 @@ func claimValueToStringSlice(claimValue interface{}) []string {
904904
switch rawGroup := claimValue.(type) {
905905
case []string:
906906
groups = rawGroup
907+
case []interface{}:
908+
for _, group := range rawGroup {
909+
groups = append(groups, fmt.Sprintf("%s", group))
910+
}
907911
default:
908912
str := fmt.Sprintf("%s", rawGroup)
909913
groups = strings.Split(str, ",")

0 commit comments

Comments
 (0)