mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 20:08:02 +00:00
80 lines
2.2 KiB
Go
80 lines
2.2 KiB
Go
|
package sessionlogout
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/zitadel/zitadel/internal/eventstore"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
eventTypePrefix = "session_logout."
|
||
|
backChannelEventTypePrefix = eventTypePrefix + "back_channel."
|
||
|
BackChannelLogoutRegisteredType = backChannelEventTypePrefix + "registered"
|
||
|
BackChannelLogoutSentType = backChannelEventTypePrefix + "sent"
|
||
|
)
|
||
|
|
||
|
type BackChannelLogoutRegisteredEvent struct {
|
||
|
*eventstore.BaseEvent `json:"-"`
|
||
|
|
||
|
OIDCSessionID string `json:"oidc_session_id"`
|
||
|
UserID string `json:"user_id"`
|
||
|
ClientID string `json:"client_id"`
|
||
|
BackChannelLogoutURI string `json:"back_channel_logout_uri"`
|
||
|
}
|
||
|
|
||
|
// Payload implements eventstore.Command.
|
||
|
func (e *BackChannelLogoutRegisteredEvent) Payload() any {
|
||
|
return e
|
||
|
}
|
||
|
|
||
|
func (e *BackChannelLogoutRegisteredEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (e *BackChannelLogoutRegisteredEvent) SetBaseEvent(b *eventstore.BaseEvent) {
|
||
|
e.BaseEvent = b
|
||
|
}
|
||
|
|
||
|
func NewBackChannelLogoutRegisteredEvent(ctx context.Context, aggregate *eventstore.Aggregate, oidcSessionID, userID, clientID, backChannelLogoutURI string) *BackChannelLogoutRegisteredEvent {
|
||
|
return &BackChannelLogoutRegisteredEvent{
|
||
|
BaseEvent: eventstore.NewBaseEventForPush(
|
||
|
ctx,
|
||
|
aggregate,
|
||
|
BackChannelLogoutRegisteredType,
|
||
|
),
|
||
|
OIDCSessionID: oidcSessionID,
|
||
|
UserID: userID,
|
||
|
ClientID: clientID,
|
||
|
BackChannelLogoutURI: backChannelLogoutURI,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
type BackChannelLogoutSentEvent struct {
|
||
|
eventstore.BaseEvent `json:"-"`
|
||
|
|
||
|
OIDCSessionID string `json:"oidc_session_id"`
|
||
|
}
|
||
|
|
||
|
func (e *BackChannelLogoutSentEvent) Payload() interface{} {
|
||
|
return e
|
||
|
}
|
||
|
|
||
|
func (e *BackChannelLogoutSentEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (e *BackChannelLogoutSentEvent) SetBaseEvent(event *eventstore.BaseEvent) {
|
||
|
e.BaseEvent = *event
|
||
|
}
|
||
|
|
||
|
func NewBackChannelLogoutSentEvent(ctx context.Context, aggregate *eventstore.Aggregate, oidcSessionID string) *BackChannelLogoutSentEvent {
|
||
|
return &BackChannelLogoutSentEvent{
|
||
|
BaseEvent: *eventstore.NewBaseEventForPush(
|
||
|
ctx,
|
||
|
aggregate,
|
||
|
BackChannelLogoutSentType,
|
||
|
),
|
||
|
OIDCSessionID: oidcSessionID,
|
||
|
}
|
||
|
}
|