This commit is contained in:
2023-05-20 11:01:31 -05:00
parent febb4aa892
commit 82193797f9

View File

@@ -63,12 +63,12 @@ func main() {
func authMiddleware(allowedGroups []string) gin.HandlerFunc { func authMiddleware(allowedGroups []string) gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {
// Get the user groups from the request headers // Get the user groups from the request headers
groupsHeader := c.GetHeader("X-Forwarded-Groups") groupsHeader := c.GetHeader("X-authentik-groups")
// Split the groups header value into individual groups // Split the groups header value into individual groups
groups := strings.Split(groupsHeader, ",") groups := strings.Split(groupsHeader, "|")
// Check if the user belongs to any of the allowed grouzps // Check if the user belongs to any of the allowed groups
isAllowed := false isAllowed := false
for _, allowedGroup := range allowedGroups { for _, allowedGroup := range allowedGroups {
for _, group := range groups { for _, group := range groups {