@@ -125,7 +125,7 @@ func TestWorkspaceContentAuthorizer(t *testing.T) {
125
125
wantReason : "delegating due to user logical cluster access" ,
126
126
},
127
127
{
128
- testName : "user with scope to another cluster is denied " ,
128
+ testName : "user with scope to another cluster is not allowed " ,
129
129
130
130
requestedWorkspace : "root:ready" ,
131
131
requestingUser : & user.DefaultInfo {Name : "user-access" , Extra : map [string ][]string {
@@ -143,26 +143,26 @@ func TestWorkspaceContentAuthorizer(t *testing.T) {
143
143
wantReason : "delegating due to local service account access" ,
144
144
},
145
145
{
146
- testName : "user is granted access on root" ,
146
+ testName : "a authenticated user is granted access on root:authenticated " ,
147
147
148
- requestedWorkspace : "root" ,
148
+ requestedWorkspace : "root:authenticated " ,
149
149
requestingUser : & user.DefaultInfo {Name : "somebody" , Groups : []string {"system:authenticated" }},
150
150
wantDecision : authorizer .DecisionAllow ,
151
151
wantReason : "delegating due to user logical cluster access" ,
152
152
},
153
153
{
154
- testName : "service account from other cluster is denied on root" ,
154
+ testName : "service account from other cluster is denied on root:authenticated " ,
155
155
156
- requestedWorkspace : "root" ,
156
+ requestedWorkspace : "root:authenticated " ,
157
157
requestingUser : newServiceAccountWithCluster ("somebody" , "someworkspace" , "system:authenticated" ),
158
158
wantDecision : authorizer .DecisionDeny ,
159
159
wantReason : "foreign service account" ,
160
160
},
161
161
{
162
- testName : "service account from root cluster is granted access on root" ,
162
+ testName : "service account from root:authenticated cluster is granted access on root:authenticated " ,
163
163
164
- requestedWorkspace : "root" ,
165
- requestingUser : newServiceAccountWithCluster ("somebody" , "root" , "system:authenticated" ),
164
+ requestedWorkspace : "root:authenticated " ,
165
+ requestingUser : newServiceAccountWithCluster ("somebody" , "root:authenticated " , "system:authenticated" ),
166
166
wantDecision : authorizer .DecisionAllow ,
167
167
wantReason : "delegating due to local service account access" ,
168
168
},
@@ -248,9 +248,9 @@ func TestWorkspaceContentAuthorizer(t *testing.T) {
248
248
& v1.ClusterRoleBinding {
249
249
ObjectMeta : metav1.ObjectMeta {
250
250
Annotations : map [string ]string {
251
- logicalcluster .AnnotationKey : "root" ,
251
+ logicalcluster .AnnotationKey : "root:authenticated " ,
252
252
},
253
- Name : "system:authenticated:access" ,
253
+ Name : "system:authenticated:root:authenticated: access" ,
254
254
},
255
255
Subjects : []v1.Subject {
256
256
{
@@ -270,7 +270,7 @@ func TestWorkspaceContentAuthorizer(t *testing.T) {
270
270
Annotations : map [string ]string {
271
271
logicalcluster .AnnotationKey : "root:ready" ,
272
272
},
273
- Name : "user-access- ready- access" ,
273
+ Name : "user-access:root: ready: access" ,
274
274
},
275
275
Subjects : []v1.Subject {
276
276
{
@@ -290,7 +290,7 @@ func TestWorkspaceContentAuthorizer(t *testing.T) {
290
290
Annotations : map [string ]string {
291
291
logicalcluster .AnnotationKey : "root:initializing" ,
292
292
},
293
- Name : "user-access- initializing- access" ,
293
+ Name : "user-access:root: initializing: access" ,
294
294
},
295
295
Subjects : []v1.Subject {
296
296
{
@@ -310,7 +310,7 @@ func TestWorkspaceContentAuthorizer(t *testing.T) {
310
310
Annotations : map [string ]string {
311
311
logicalcluster .AnnotationKey : "rootwithoutparent" ,
312
312
},
313
- Name : "system:authenticated :access" ,
313
+ Name : "user-access:rootwithoutparent :access" ,
314
314
},
315
315
Subjects : []v1.Subject {
316
316
{
@@ -343,7 +343,7 @@ func TestWorkspaceContentAuthorizer(t *testing.T) {
343
343
344
344
localIndexer := cache .NewIndexer (kcpcache .MetaClusterNamespaceKeyFunc , cache.Indexers {})
345
345
require .NoError (t , localIndexer .Add (& corev1alpha1.LogicalCluster {
346
- ObjectMeta : metav1.ObjectMeta {Name : corev1alpha1 .LogicalClusterName , Annotations : map [string ]string {logicalcluster .AnnotationKey : "root" }},
346
+ ObjectMeta : metav1.ObjectMeta {Name : corev1alpha1 .LogicalClusterName , Annotations : map [string ]string {logicalcluster .AnnotationKey : "root:authenticated " }},
347
347
Status : corev1alpha1.LogicalClusterStatus {Phase : corev1alpha1 .LogicalClusterPhaseReady },
348
348
}))
349
349
require .NoError (t , localIndexer .Add (& corev1alpha1.LogicalCluster {
0 commit comments