File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments