feat(api/v2): store user agent details in the session (#6711)

This change adds the ability to set and get user agent data, such as fingerprint, IP, request headers and a description to the session. All fields are optional.

Closes #6028
This commit is contained in:
Tim Möhlmann
2023-10-12 15:16:59 +03:00
committed by GitHub
parent a272b1201f
commit c71bf85b7a
16 changed files with 634 additions and 147 deletions

View File

@@ -35,6 +35,7 @@ const (
type AddedEvent struct {
eventstore.BaseEvent `json:"-"`
UserAgent *domain.UserAgent `json:"user_agent,omitempty"`
}
func (e *AddedEvent) Data() interface{} {
@@ -47,6 +48,7 @@ func (e *AddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
func NewAddedEvent(ctx context.Context,
aggregate *eventstore.Aggregate,
userAgent *domain.UserAgent,
) *AddedEvent {
return &AddedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
@@ -54,6 +56,7 @@ func NewAddedEvent(ctx context.Context,
aggregate,
AddedType,
),
UserAgent: userAgent,
}
}