Skip to content

Commit 1b4dbae

Browse files
committed
Add authentication.kcp.io/cluster-name to workspace auth
Signed-off-by: Nelo-T. Wallus <[email protected]> Signed-off-by: Nelo-T. Wallus <[email protected]>
1 parent c702955 commit 1b4dbae

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

pkg/authentication/authenticators.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func withClusterScope(delegate authenticator.Request) authenticator.Request {
4848
extra = map[string][]string{}
4949
}
5050
extra["authentication.kcp.io/scopes"] = append(extra["authentication.kcp.io/scopes"], fmt.Sprintf("cluster:%s", cluster))
51+
extra["authentication.kcp.io/cluster-name"] = []string{cluster.String()}
5152

5253
response.User = &user.DefaultInfo{
5354
Name: response.User.GetName(),

test/e2e/authentication/workspace_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ func TestUserScope(t *testing.T) {
316316
require.Equal(t, "oidc:"+userEmail, user.Username)
317317
require.Subset(t, user.Groups, expectedGroups)
318318
require.Equal(t, user.Extra["authentication.kcp.io/scopes"], authenticationv1.ExtraValue{"cluster:" + teamWs.Spec.Cluster})
319+
require.Equal(t, user.Extra["authentication.kcp.io/cluster-name"], authenticationv1.ExtraValue{teamWs.Spec.Cluster})
319320
}
320321

321322
func TestForbiddenSystemAccess(t *testing.T) {

0 commit comments

Comments
 (0)