feat: implement instance-level UpdateZitadelProvider (#12378)

# Which Problems Are Solved

This PR implements the instance-level `UpdateZitadelProvider` endpoint,
enabling updates to existing instance Zitadel IdP templates.

# How the Problems Are Solved

- Added `AdminService.UpdateZitadelProvider` handler, converter
- Added the command-layer implementation to update a ZitadelProvider and
push `instance.idp.zitadel.changed` event
- Added projection-layer implementation to persist Zitadel provider
updates into `projections.idp_templates6_zitadel`
- Added unit and integration tests


# Additional Changes
N/A

# Additional Context
Related to https://github.com/zitadel/zitadel/issues/11922
Follow-up for PRs:
- https://github.com/zitadel/zitadel/pull/12018
- https://github.com/zitadel/zitadel/pull/12020
- https://github.com/zitadel/zitadel/pull/12055
- https://github.com/zitadel/zitadel/pull/12056
- https://github.com/zitadel/zitadel/pull/12371

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
This commit is contained in:
Gayathri Vijayan
2026-07-06 10:18:35 +02:00
committed by GitHub
co-authored by Copilot Autofix powered by AI
parent 1beabed8cf
commit 653a968d91
13 changed files with 1327 additions and 16 deletions
+28
View File
@@ -1058,6 +1058,8 @@ func (wm *InstanceZitadelIDPWriteModel) AppendEvents(events ...eventstore.Event)
switch e := event.(type) {
case *instance.ZitadelIDPAddedEvent:
wm.ZitadelIDPWriteModel.AppendEvents(&e.ZitadelIDPAddedEvent)
case *instance.ZitadelIDPChangedEvent:
wm.ZitadelIDPWriteModel.AppendEvents(&e.ZitadelIDPChangedEvent)
default:
wm.ZitadelIDPWriteModel.AppendEvents(e)
}
@@ -1076,3 +1078,29 @@ func (wm *InstanceZitadelIDPWriteModel) Query() *eventstore.SearchQueryBuilder {
EventData(map[string]interface{}{"id": wm.ID}).
Builder()
}
func (wm *InstanceZitadelIDPWriteModel) NewChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
id, name, issuer, clientID, clientSecretString string,
secretCrypto crypto.EncryptionAlgorithm,
scopes []string,
options idp.Options,
info []idp.RolesInfo,
) (*instance.ZitadelIDPChangedEvent, error) {
changes, err := wm.NewChanges(
name,
issuer,
clientID,
clientSecretString,
secretCrypto,
scopes,
options,
info,
)
if err != nil || len(changes) == 0 {
return nil, err
}
return instance.NewZitadelIDPChangedEvent(ctx, aggregate, id, changes), nil
}