Skip to content

Commit 7d45255

Browse files
authored
Fix OAuth Source Edit Page (#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 db7c3ec commit 7d45255

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

routers/web/admin/auths.go

Lines changed: 3 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,10 @@ func claimValueToStringSlice(claimValue interface{}) []string {
900900
switch rawGroup := claimValue.(type) {
901901
case []string:
902902
groups = rawGroup
903+
case []interface{}:
904+
for _, group := range rawGroup {
905+
groups = append(groups, fmt.Sprintf("%s", group))
906+
}
903907
default:
904908
str := fmt.Sprintf("%s", rawGroup)
905909
groups = strings.Split(str, ",")

0 commit comments

Comments
 (0)