Help us shape the future of Go! Take the 2026 Go Developer Survey

loginlog

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package loginlog is a minimal writer for the login_events table used by the panel login and the OIDC flows (stream B1). It is intentionally tiny so it can be replaced by a full login_events repository in internal/store later: only Record and Event are used by callers.

Index

Constants

View Source
const (
	MethodPassword = "password"
	MethodOIDC     = "oidc"
	MethodWebAuth  = "webauth"
	MethodPasskey  = "passkey"
)

Method values of login_events.method.

View Source
const (
	ClientWebAdmin = "webadmin"
	ClientClient   = "client"
)

Client kinds (login_events.client_kind).

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Q   db.Querier
	Now func() time.Time
}

DB records events with plain SQL on q.

func (DB) Record

func (d DB) Record(ctx context.Context, e Event) error

Record implements Recorder.

type Event

type Event struct {
	UserID            *int64
	UsernameAttempted string
	TokenID           *int64
	Method            string
	Success           bool
	FailureReason     string
	ClientKind        string
	DeviceRustdeskID  string
	DeviceUUID        string
	Platform          string
	IP                string
	UserAgent         string
	At                time.Time
}

Event is one login attempt. Never put secrets in FailureReason.

type Recorder

type Recorder interface {
	Record(ctx context.Context, e Event) error
}

Recorder writes login events.

Jump to

Keyboard shortcuts

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