Skip to content

Commit 0c6d6b7

Browse files
committed
fix: resolving review comments
1 parent 802a046 commit 0c6d6b7

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

authenticator/client/oidcClient.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,18 @@ func (conf *DexConfig) GetDexScopes() []string {
6262
defaultScopes := oidc.GetScopesOrDefault([]string{})
6363
additionalScopes := conf.DexScopes
6464

65-
// if no additional scopes configured return only default scopes
66-
if len(additionalScopes) == 0 {
67-
return defaultScopes
68-
}
69-
70-
occurrenceMap := make(map[string]struct{})
71-
finalScopes := make([]string, 0)
65+
occurrenceMap := make(map[string]bool)
66+
finalScopes := make([]string, 0, len(defaultScopes)+len(additionalScopes))
7267

7368
// first add all the default
7469
for _, scope := range defaultScopes {
75-
occurrenceMap[scope] = struct{}{}
70+
occurrenceMap[scope] = true
7671
finalScopes = append(finalScopes, scope)
7772
}
7873
// append extra configs
7974
for _, scope := range additionalScopes {
8075
if _, exists := occurrenceMap[scope]; !exists {
81-
occurrenceMap[scope] = struct{}{}
76+
occurrenceMap[scope] = true
8277
finalScopes = append(finalScopes, scope)
8378
}
8479
}

0 commit comments

Comments
 (0)