@@ -115,10 +115,14 @@ func EffectiveUsers(clusterName logicalcluster.Name, u user.Info) []user.Info {
115
115
Name : fmt .Sprintf ("system:kcp:serviceaccount:%s:%s" , clusters [0 ], nsNameSuffix ),
116
116
Extra : u .GetExtra (),
117
117
}
118
+ // Filter groups to only include system:authenticated
119
+ // and system:cluster:*
118
120
for _ , g := range u .GetGroups () {
119
121
if g == user .AllAuthenticated {
120
- rewritten .Groups = []string {user .AllAuthenticated }
121
- break
122
+ rewritten .Groups = append (rewritten .Groups , user .AllAuthenticated )
123
+ }
124
+ if strings .HasPrefix (g , "system:cluster:" ) {
125
+ rewritten .Groups = append (rewritten .Groups , g )
122
126
}
123
127
}
124
128
ret = append (ret , rewritten )
@@ -147,7 +151,16 @@ func EffectiveUsers(clusterName logicalcluster.Name, u user.Info) []user.Info {
147
151
recursive (u )
148
152
149
153
if wantAuthenticated {
150
- ret = append (ret , authenticated )
154
+ authed := & user.DefaultInfo {
155
+ Name : user .Anonymous ,
156
+ Groups : []string {user .AllAuthenticated },
157
+ }
158
+ for _ , g := range u .GetGroups () {
159
+ if strings .HasPrefix (g , "system:cluster:" ) {
160
+ authed .Groups = append (authed .Groups , g )
161
+ }
162
+ }
163
+ ret = append (ret , authed )
151
164
}
152
165
if wantUnauthenticated {
153
166
ret = append (ret , unauthenticated )
0 commit comments