Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Márk Sági-Kazár <[email protected]>
Signed-off-by: Oded Ben Ozer <[email protected]>
  • Loading branch information
Oded-B and sagikazarmark committed Oct 25, 2023
1 parent 6875b64 commit 033717a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions connector/oidc/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit 033717a

Please sign in to comment.