Skip to content

Commit 1ee302d

Browse files
authored
plugin/wif: support external plugins (#26384)
* plugin/wif: support external plugins * changelog
1 parent e4f9d02 commit 1ee302d

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

changelog/26384.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
plugin/wif: fix a bug where the namespace was not set for external plugins using workload identity federation
3+
```

sdk/plugin/grpc_system.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ func (s *gRPCSystemViewServer) GenerateIdentityToken(ctx context.Context, req *p
421421
})
422422
if err != nil {
423423
return &pb.GenerateIdentityTokenResponse{}, status.Errorf(codes.Internal,
424-
"failed to generate plugin identity token")
424+
err.Error())
425425
}
426426

427427
return &pb.GenerateIdentityTokenResponse{

vault/dynamic_system_view.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -459,12 +459,17 @@ func (d dynamicSystemView) ClusterID(ctx context.Context) (string, error) {
459459
}
460460

461461
func (d dynamicSystemView) GenerateIdentityToken(ctx context.Context, req *pluginutil.IdentityTokenRequest) (*pluginutil.IdentityTokenResponse, error) {
462-
storage := d.core.router.MatchingStorageByAPIPath(ctx, mountPathIdentity)
462+
mountEntry := d.mountEntry
463+
if mountEntry == nil {
464+
return nil, fmt.Errorf("no mount entry")
465+
}
466+
nsCtx := namespace.ContextWithNamespace(ctx, mountEntry.Namespace())
467+
storage := d.core.router.MatchingStorageByAPIPath(nsCtx, mountPathIdentity)
463468
if storage == nil {
464469
return nil, fmt.Errorf("failed to find storage entry for identity mount")
465470
}
466471

467-
token, ttl, err := d.core.IdentityStore().generatePluginIdentityToken(ctx, storage, d.mountEntry, req.Audience, req.TTL)
472+
token, ttl, err := d.core.IdentityStore().generatePluginIdentityToken(nsCtx, storage, d.mountEntry, req.Audience, req.TTL)
468473
if err != nil {
469474
return nil, fmt.Errorf("failed to generate plugin identity token: %w", err)
470475
}

0 commit comments

Comments
 (0)