mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 20:38:00 +00:00
b5564572bc
This implementation increases parallel write capabilities of the eventstore. Please have a look at the technical advisories: [05](https://zitadel.com/docs/support/advisory/a10005) and [06](https://zitadel.com/docs/support/advisory/a10006). The implementation of eventstore.push is rewritten and stored events are migrated to a new table `eventstore.events2`. If you are using cockroach: make sure that the database user of ZITADEL has `VIEWACTIVITY` grant. This is used to query events.
85 lines
2.0 KiB
Go
85 lines
2.0 KiB
Go
package instance
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
"github.com/zitadel/zitadel/internal/repository/idpconfig"
|
|
)
|
|
|
|
const (
|
|
IDPJWTConfigAddedEventType eventstore.EventType = "iam.idp." + idpconfig.JWTConfigAddedEventType
|
|
IDPJWTConfigChangedEventType eventstore.EventType = "iam.idp." + idpconfig.JWTConfigChangedEventType
|
|
)
|
|
|
|
type IDPJWTConfigAddedEvent struct {
|
|
idpconfig.JWTConfigAddedEvent
|
|
}
|
|
|
|
func NewIDPJWTConfigAddedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
idpConfigID,
|
|
jwtEndpoint,
|
|
issuer,
|
|
keysEndpoint,
|
|
headerName string,
|
|
) *IDPJWTConfigAddedEvent {
|
|
return &IDPJWTConfigAddedEvent{
|
|
JWTConfigAddedEvent: *idpconfig.NewJWTConfigAddedEvent(
|
|
eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
aggregate,
|
|
IDPJWTConfigAddedEventType,
|
|
),
|
|
idpConfigID,
|
|
jwtEndpoint,
|
|
issuer,
|
|
keysEndpoint,
|
|
headerName,
|
|
),
|
|
}
|
|
}
|
|
|
|
func IDPJWTConfigAddedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
|
e, err := idpconfig.JWTConfigAddedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &IDPJWTConfigAddedEvent{JWTConfigAddedEvent: *e.(*idpconfig.JWTConfigAddedEvent)}, nil
|
|
}
|
|
|
|
type IDPJWTConfigChangedEvent struct {
|
|
idpconfig.JWTConfigChangedEvent
|
|
}
|
|
|
|
func NewIDPJWTConfigChangedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
idpConfigID string,
|
|
changes []idpconfig.JWTConfigChanges,
|
|
) (*IDPJWTConfigChangedEvent, error) {
|
|
changeEvent, err := idpconfig.NewJWTConfigChangedEvent(
|
|
eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
aggregate,
|
|
IDPJWTConfigChangedEventType),
|
|
idpConfigID,
|
|
changes,
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &IDPJWTConfigChangedEvent{JWTConfigChangedEvent: *changeEvent}, nil
|
|
}
|
|
|
|
func IDPJWTConfigChangedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
|
e, err := idpconfig.JWTConfigChangedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &IDPJWTConfigChangedEvent{JWTConfigChangedEvent: *e.(*idpconfig.JWTConfigChangedEvent)}, nil
|
|
}
|