From 033717a07e1bd2e44d5d28578ba8a20ac87f1746 Mon Sep 17 00:00:00 2001
From: Oded Ben Ozer <oded.benozer@gmail.com>
Date: Wed, 25 Oct 2023 14:08:34 +0200
Subject: [PATCH] Apply suggestions from code review
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Márk Sági-Kazár <sagikazarmark@users.noreply.github.com>
Signed-off-by: Oded Ben Ozer <oded.benozer@gmail.com>
---
 connector/oidc/oidc.go | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/connector/oidc/oidc.go b/connector/oidc/oidc.go
index 5b43d2e0..7f714518 100644
--- a/connector/oidc/oidc.go
+++ b/connector/oidc/oidc.go
@@ -94,7 +94,7 @@ type Config struct {
 	} `json:"claimModifications"`
 }
 
-// List of groups claim elements to create by concatenating other claims
+// NewGroupFromClaims creates a new group from a list of claims and appends it to the list of existing groups.
 type NewGroupsFromClaims struct {
 	// List of claim to join together
 	ClaimList []string `json:"claimList"`
@@ -456,15 +456,16 @@ func (c *oidcConnector) createIdentity(ctx context.Context, identity connector.I
 		}
 		for _, claimName := range config.ClaimList {
 			claimValue, ok := claims[claimName].(string)
-			// Non string claim value are ignored, concatenating them doesn't really make any sense
-			if !ok {
+			if !ok { // Non string claim value are ignored, concatenating them doesn't really make any sense
 				continue
 			}
+
 			if config.ClearDelimiter {
 				// Removing the delimiter string from the concatenated claim to ensure resulting claim structure
 				// is in full control of Dex operator
 				claimValue = strings.ReplaceAll(claimValue, config.Delimiter, "")
 			}
+
 			newGroupSegments = append(newGroupSegments, claimValue)
 		}
 
-- 
GitLab