Go 1.27 (#755)
Docker / Build and Push (push) Canceled after 0s
github-pages / deploy (push) Canceled after 0s
Test / make test (push) Canceled after 0s
Docker / release (push) Canceled after 0s

* update to go 1.27

* go fix changes
This commit is contained in:
h44z
2026-09-12 17:52:01 +02:00
committed by GitHub
parent 34ee98a51e
commit 38c372e239
46 changed files with 418 additions and 505 deletions
+11 -15
View File
@@ -1,6 +1,7 @@
package auth
import (
"slices"
"strings"
"github.com/h44z/wg-portal/internal"
@@ -49,11 +50,8 @@ func parseOauthUserInfo(
if !isAdmin && mapping.UserGroups != "" && adminMapping.AdminGroupRegex != "" {
adminInfoAvailable = true
re := adminMapping.GetAdminGroupRegex()
for _, group := range userInfo.UserGroups {
if re.MatchString(group) {
isAdmin = true
break
}
if slices.ContainsFunc(userInfo.UserGroups, re.MatchString) {
isAdmin = true
}
userInfo.IsAdmin = isAdmin
userInfo.AdminInfoAvailable = adminInfoAvailable
@@ -65,16 +63,14 @@ func parseOauthUserInfo(
// getOauthFieldMapping returns the default field mapping for the oauth provider
func getOauthFieldMapping(f config.OauthFields) config.OauthFields {
defaultMap := config.OauthFields{
BaseFields: config.BaseFields{
UserIdentifier: "sub",
Email: "email",
Firstname: "given_name",
Lastname: "family_name",
Phone: "phone",
Department: "department",
},
IsAdmin: "admin_flag",
UserGroups: "", // by default, do not use user groups
UserIdentifier: "sub",
Email: "email",
Firstname: "given_name",
Lastname: "family_name",
Phone: "phone",
Department: "department",
IsAdmin: "admin_flag",
UserGroups: "", // by default, do not use user groups
}
if f.UserIdentifier != "" {
defaultMap.UserIdentifier = f.UserIdentifier