Skip to content

Commit ddd98db

Browse files
fix(core)!: DSPX-2090 Removes unnamed key mgrs (#2952)
- These can't be loaded properly ### Proposed Changes * ### Checklist - [ ] I have added or updated unit tests - [ ] I have added or updated integration tests (if appropriate) - [ ] I have added or updated documentation ### Testing Instructions
1 parent 62a9fc5 commit ddd98db

File tree

4 files changed

+1
-27
lines changed

4 files changed

+1
-27
lines changed

service/kas/kas.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ func NewRegistration() *serviceregistry.Service[kasconnect.AccessServiceHandler]
7575

7676
// Configure new delegation service
7777
p.KeyDelegator = trust.NewDelegatingKeyService(NewPlatformKeyIndexer(srp.SDK, kasURL.String(), srp.Logger), srp.Logger, cacheClient)
78-
if len(srp.KeyManagerFactories) > 0 {
79-
srp.Logger.Error("kas service ignores legacy KeyManagerFactories; using KeyManagerCtxFactories instead")
80-
}
8178
for _, manager := range srp.KeyManagerCtxFactories {
8279
p.KeyDelegator.RegisterKeyManagerCtx(manager.Name, manager.Factory)
8380
kmgrs = append(kmgrs, manager.Name)

service/pkg/server/services.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,6 @@ func startServices(ctx context.Context, params startServicesParams) (func(), err
142142
cacheManager := params.cacheManager
143143
keyManagerCtxFactories := params.keyManagerCtxFactories
144144

145-
// Create a copy of the key manager factories as the context version for legacy services that don't load the new version with context
146-
var keyManagerFactories []trust.NamedKeyManagerFactory
147-
for _, factory := range keyManagerCtxFactories {
148-
keyManagerFactories = append(keyManagerFactories, trust.NamedKeyManagerFactory{
149-
Name: factory.Name,
150-
//nolint:contextcheck // This is called later, so will be in a new context
151-
Factory: func(opts *trust.KeyManagerFactoryOptions) (trust.KeyManager, error) {
152-
return factory.Factory(context.Background(), opts)
153-
},
154-
})
155-
}
156-
157145
// Iterate through the registered namespaces
158146
for _, nsInfo := range reg.GetNamespaces() {
159147
ns := nsInfo.Name
@@ -229,7 +217,6 @@ func startServices(ctx context.Context, params startServicesParams) (func(), err
229217
OTDF: otdf, // TODO: REMOVE THIS
230218
Tracer: tracer,
231219
NewCacheClient: createCacheClient,
232-
KeyManagerFactories: keyManagerFactories,
233220
KeyManagerCtxFactories: keyManagerCtxFactories,
234221
})
235222
if err != nil {

service/pkg/serviceregistry/serviceregistry.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ type RegistrationParams struct {
5151
// NewCacheClient is a function that can be used to create a new cache instance for the service
5252
NewCacheClient func(cache.Options) (*cache.Cache, error)
5353

54-
// KeyManagerFactories are the registered key manager factories that can be used to create
55-
// key managers for the service to use.
56-
// Prefer KeyManagerCtxFactories
57-
// EXPERIMENTAL
58-
KeyManagerFactories []trust.NamedKeyManagerFactory
59-
6054
// KeyManagerCtxFactories are the registered key manager context factories that can be used to create
6155
// key managers for the service to use.
6256
// EXPERIMENTAL

service/policy/keymanagement/key_management.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,8 @@ func NewRegistration(ns string, dbRegister serviceregistry.DBRegister) *servicer
6767
ksvc.config = cfg
6868
ksvc.dbClient = policydb.NewClient(srp.DBClient, srp.Logger, int32(cfg.ListRequestLimitMax), int32(cfg.ListRequestLimitDefault))
6969

70-
// Register key managers in well-known configuration
71-
ksvc.keyManagerFactories = make([]registeredManagers, 0, len(srp.KeyManagerFactories))
72-
if len(srp.KeyManagerFactories) > 0 {
73-
srp.Logger.Error("keymanagement: ignoring legacy KeyManagerFactories; using KeyManagerCtxFactories instead")
74-
}
7570
managersMap := make(map[string]any)
71+
ksvc.keyManagerFactories = make([]registeredManagers, 0, len(srp.KeyManagerCtxFactories))
7672
for i, factory := range srp.KeyManagerCtxFactories {
7773
rm := registeredManagers{
7874
Name: factory.Name,

0 commit comments

Comments
 (0)