From c5b3f991724b4ecbc466144007f16b93ea7ba158 Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Sat, 24 Jun 2023 22:38:00 -0400 Subject: [PATCH] add groups logging --- main.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/main.go b/main.go index 6cbfc28..64c8e66 100644 --- a/main.go +++ b/main.go @@ -77,14 +77,12 @@ func authMiddleware(allowedGroups []string) gin.HandlerFunc { if groupsenv != "" { groups = strings.Split(groupsenv, ",") } else { - // Get the user groups from the request headers groupsHeader := c.GetHeader("X-authentik-groups") - // Split the groups header value into individual groups + fmt.Println(groupsHeader) groups = strings.Split(groupsHeader, "|") } - // Check if the user belongs to any of the allowed groups isAllowed := false for _, allowedGroup := range allowedGroups { for _, group := range groups { @@ -98,7 +96,6 @@ func authMiddleware(allowedGroups []string) gin.HandlerFunc { } } - // If the user is not in any of the allowed groups, respond with unauthorized access if !isAllowed { c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{ "message": "Unauthorized access",