Skip to content

Commit 0013aad

Browse files
committed
Add authenticated group adder to workspace auth
Signed-off-by: Nelo-T. Wallus <[email protected]> Signed-off-by: Nelo-T. Wallus <[email protected]>
1 parent 9d893bb commit 0013aad

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

docs/content/concepts/authentication/workspace.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ This feature has some small limitations that users should keep in mind:
4545
* Workspace authenticators are started asynchronously and it will take a couple of seconds for them to be ready.
4646
* The workspace authentication in the localproxy, as part of a single shard server, only knows about the data on the local shard and cannot handle cross-shard authentication. Users are advised to use the front-proxy instead.
4747
* Even when the feature is disabled on all shards and all front-proxies, the API (CRDs) are always available in kcp. Admins might uses RBAC or webhooks to prevent creating `WorkspaceAuthenticationConfiguration` objects if needed.
48+
* It is not possible to authenticate users with a username starting with with `system:` through per-workspace authentication.
49+
* It is not possible to assign groups starting with `system:` to users authenticated via per-workspace authentication, e.g. via claim mappings.
4850

4951
## Example
5052

pkg/authentication/filters.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"net/http"
2222

2323
"k8s.io/apiserver/pkg/authentication/authenticator"
24+
"k8s.io/apiserver/pkg/authentication/group"
2425

2526
"github.com/kcp-dev/kcp/pkg/proxy/lookup"
2627
)
@@ -43,6 +44,8 @@ func WithWorkspaceAuthResolver(handler http.Handler, authIndex AuthenticatorInde
4344
return
4445
}
4546

47+
authn = group.NewAuthenticatedGroupAdder(authn)
48+
4649
// make the authenticator always add the target cluster to the user scopes
4750
authn = withClusterScope(authn)
4851

test/e2e/authentication/workspace_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ func TestUserScope(t *testing.T) {
282282
userName = "peter"
283283
userEmail = "[email protected]"
284284
userGroups = []string{"developers", "admins"}
285-
expectedGroups = []string{}
285+
expectedGroups = []string{"system:authenticated"}
286286
)
287287

288288
for _, group := range userGroups {

0 commit comments

Comments
 (0)