securityevent

package
v0.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStoreRequired = errors.New("security event store is required")

Functions

This section is empty.

Types

type Authentication

type Authentication struct {
	Outcome              domain.SecurityEventOutcome
	ReasonCode           string
	ActorType            domain.SecurityEventActorType
	ActorUserID          *uuid.UUID
	UserID               *uuid.UUID
	SessionID            *uuid.UUID
	OrganizationID       *uuid.UUID
	PasskeyID            *uuid.UUID
	AuthenticationMethod domain.AuthenticationMethod
}

type Config

type Config struct {
	Store         *store.Store
	EnabledEvents map[domain.SecurityEventType]struct{}
	Retention     time.Duration
}

type Credential

type Credential struct {
	ActorType   domain.SecurityEventActorType
	ActorUserID *uuid.UUID
	UserID      uuid.UUID
	SessionID   *uuid.UUID
	PasskeyID   *uuid.UUID
	Provider    domain.Provider
}

type Filter

type Filter = store.SecurityEventFilter

type NoopRecorder

type NoopRecorder struct{}

func (NoopRecorder) AccountEmailChanged

func (NoopRecorder) AccountEmailChanged(context.Context, Credential) error

func (NoopRecorder) AuthenticationLogin

func (NoopRecorder) AuthenticationLogin(context.Context, Authentication) error

func (NoopRecorder) AuthenticationReauthenticated

func (NoopRecorder) AuthenticationReauthenticated(context.Context, Authentication) error

func (NoopRecorder) CredentialPasskeyAdded

func (NoopRecorder) CredentialPasskeyAdded(context.Context, Credential) error

func (NoopRecorder) CredentialPasskeyRemoved

func (NoopRecorder) CredentialPasskeyRemoved(context.Context, Credential) error

func (NoopRecorder) CredentialPasswordAdded

func (NoopRecorder) CredentialPasswordAdded(context.Context, Credential) error

func (NoopRecorder) CredentialPasswordChanged

func (NoopRecorder) CredentialPasswordChanged(context.Context, Credential) error

func (NoopRecorder) CredentialPasswordReset

func (NoopRecorder) CredentialPasswordReset(context.Context, Credential) error

func (NoopRecorder) CredentialProviderChanged

func (NoopRecorder) CredentialProviderChanged(context.Context, Credential) error

func (NoopRecorder) CredentialProviderLinked

func (NoopRecorder) CredentialProviderLinked(context.Context, Credential) error

func (NoopRecorder) CredentialProviderRemoved

func (NoopRecorder) CredentialProviderRemoved(context.Context, Credential) error

func (NoopRecorder) PasskeyCloneWarning

func (NoopRecorder) PasskeyCloneWarning(context.Context, PasskeyClone) error

func (NoopRecorder) SessionLogout

func (NoopRecorder) SessionLogout(context.Context, Session) error

func (NoopRecorder) SessionRefresh

func (NoopRecorder) SessionRefresh(context.Context, Session) error

func (NoopRecorder) SessionRefreshTokenReuse

func (NoopRecorder) SessionRefreshTokenReuse(context.Context, Session) error

func (NoopRecorder) SessionRevoked

func (NoopRecorder) SessionRevoked(context.Context, Session) error

type PasskeyClone

type PasskeyClone struct {
	UserID    uuid.UUID
	PasskeyID uuid.UUID
	Outcome   domain.SecurityEventOutcome
	Response  string
}

type Recorder

type Recorder interface {
	AuthenticationLogin(context.Context, Authentication) error
	AuthenticationReauthenticated(context.Context, Authentication) error
	SessionRefresh(context.Context, Session) error
	SessionRefreshTokenReuse(context.Context, Session) error
	SessionLogout(context.Context, Session) error
	SessionRevoked(context.Context, Session) error
	CredentialPasswordAdded(context.Context, Credential) error
	CredentialPasswordChanged(context.Context, Credential) error
	CredentialPasswordReset(context.Context, Credential) error
	CredentialProviderLinked(context.Context, Credential) error
	CredentialProviderChanged(context.Context, Credential) error
	CredentialProviderRemoved(context.Context, Credential) error
	CredentialPasskeyAdded(context.Context, Credential) error
	CredentialPasskeyRemoved(context.Context, Credential) error
	AccountEmailChanged(context.Context, Credential) error
	PasskeyCloneWarning(context.Context, PasskeyClone) error
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config) *Service

func NewStandard

func NewStandard(st *store.Store, retention time.Duration) *Service

func (*Service) AccountEmailChanged

func (s *Service) AccountEmailChanged(ctx context.Context, event Credential) error

func (*Service) AuthenticationLogin

func (s *Service) AuthenticationLogin(ctx context.Context, event Authentication) error

func (*Service) AuthenticationReauthenticated

func (s *Service) AuthenticationReauthenticated(ctx context.Context, event Authentication) error

func (*Service) CleanupExpiredBatch

func (s *Service) CleanupExpiredBatch(ctx context.Context, now time.Time, batchSize int) (int64, bool, error)

func (*Service) CredentialPasskeyAdded

func (s *Service) CredentialPasskeyAdded(ctx context.Context, event Credential) error

func (*Service) CredentialPasskeyRemoved

func (s *Service) CredentialPasskeyRemoved(ctx context.Context, event Credential) error

func (*Service) CredentialPasswordAdded

func (s *Service) CredentialPasswordAdded(ctx context.Context, event Credential) error

func (*Service) CredentialPasswordChanged

func (s *Service) CredentialPasswordChanged(ctx context.Context, event Credential) error

func (*Service) CredentialPasswordReset

func (s *Service) CredentialPasswordReset(ctx context.Context, event Credential) error

func (*Service) CredentialProviderChanged

func (s *Service) CredentialProviderChanged(ctx context.Context, event Credential) error

func (*Service) CredentialProviderLinked

func (s *Service) CredentialProviderLinked(ctx context.Context, event Credential) error

func (*Service) CredentialProviderRemoved

func (s *Service) CredentialProviderRemoved(ctx context.Context, event Credential) error

func (*Service) Enabled

func (s *Service) Enabled(eventType domain.SecurityEventType) bool

func (*Service) ExportNDJSON

func (s *Service) ExportNDJSON(ctx context.Context, filter Filter, dst io.Writer) error

func (*Service) PasskeyCloneWarning

func (s *Service) PasskeyCloneWarning(ctx context.Context, event PasskeyClone) error

func (*Service) Query

func (s *Service) Query(ctx context.Context, filter Filter) ([]domain.SecurityEvent, error)

func (*Service) SessionLogout

func (s *Service) SessionLogout(ctx context.Context, event Session) error

func (*Service) SessionRefresh

func (s *Service) SessionRefresh(ctx context.Context, event Session) error

func (*Service) SessionRefreshTokenReuse

func (s *Service) SessionRefreshTokenReuse(ctx context.Context, event Session) error

func (*Service) SessionRevoked

func (s *Service) SessionRevoked(ctx context.Context, event Session) error

type Session

type Session struct {
	Outcome              domain.SecurityEventOutcome
	ReasonCode           string
	ActorType            domain.SecurityEventActorType
	ActorUserID          *uuid.UUID
	UserID               *uuid.UUID
	SessionID            *uuid.UUID
	OrganizationID       *uuid.UUID
	AuthenticationMethod domain.AuthenticationMethod
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL