Files
zitadel/internal/repository/idp/zitadel.go
T
bb3b52dda3 feat: command layer implementation for AddZitadelProvider (#12020)
# Which Problems Are Solved

This PR contains the command-layer implementation to add an instance IDP
of the type `ZitadelProvider`

# How the Problems Are Solved
- Implementing `AddZitadelProvider` in AdminService 
- Adding the command-layer to create a `ZitadelProvider` and push
`ZitadelIDPAddedEvent`

# Additional Changes
N/A

# Additional Context
- Related to https://github.com/zitadel/zitadel/issues/11823
- Follow-up for PR https://github.com/zitadel/zitadel/pull/12018

---------

Co-authored-by: Copilot <[email protected]>
2026-04-13 15:05:36 +00:00

62 lines
1.6 KiB
Go

package idp
import (
"github.com/zitadel/zitadel/internal/crypto"
"github.com/zitadel/zitadel/internal/eventstore"
)
type RolesInfo struct {
OrganizationID string `json:"organizationId"`
OrganizationDomain string `json:"organizationDomain"`
}
type ZitadelIDPAddedEvent struct {
eventstore.BaseEvent `json:"-"`
ID string `json:"id"`
Name string `json:"name"`
Issuer string `json:"issuer"`
ClientID string `json:"clientId"`
ClientSecret *crypto.CryptoValue `json:"clientSecret"`
Scopes []string `json:"scopes,omitempty"`
InstanceRolesInfo []RolesInfo `json:"instanceRolesInfo,omitempty"`
Options
}
func NewZitadelIDPAddedEvent(
base *eventstore.BaseEvent,
id,
name,
issuer,
clientID string,
clientSecret *crypto.CryptoValue,
scopes []string,
options Options,
instanceRolesInfo []RolesInfo,
) *ZitadelIDPAddedEvent {
return &ZitadelIDPAddedEvent{
BaseEvent: *base,
ID: id,
Name: name,
Issuer: issuer,
ClientID: clientID,
ClientSecret: clientSecret,
Scopes: scopes,
Options: options,
InstanceRolesInfo: instanceRolesInfo,
}
}
func (e *ZitadelIDPAddedEvent) Payload() interface{} {
return e
}
func (e *ZitadelIDPAddedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
return nil
}
type ZitadelIDPChangedEvent struct {
eventstore.BaseEvent `json:"-"`
// todo (@grvijayan): will be added along with UpdateZitadelProvider changes
}