web

package
v0.97.8 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: GPL-3.0 Imports: 54 Imported by: 0

Documentation

Overview

Package web provides a web UI module with server-rendered HTML pages.

Index

Constants

View Source
const Name = "web"

Variables

This section is empty.

Functions

func AttachCSRFForTest added in v0.97.8

func AttachCSRFForTest(req *http.Request)

AttachCSRFForTest sets a fixed CSRF cookie and matching X-CSRF-Token header on req. Use for unit and BDD tests that perform state-changing /service/web requests. Safe to call after Header.Set("Cookie", ...) — appends csrfToken to the Cookie header.

func InitForE2E

func InitForE2E(configData json.RawMessage) error

InitForE2E initializes the web module handler for e2e testing. It calls the package-level handler.Init with the provided JSON config, bypassing the uber/fx dependency injection used in production.

func MountForE2E

func MountForE2E(app *fiber.App)

MountForE2E mounts web module routes onto the given Fiber app.

func Register

func Register()

Register registers the web module handler.

func SetLoginRateLimiterCache

func SetLoginRateLimiterCache(s *cache.RedisStore)

SetLoginRateLimiterCache stores the Redis backend for the login rate limiter. The limiter is wired after web module Init so YAML auth.brute_force is applied.

Types

type AuthConfig

type AuthConfig struct {
	Username     string           `json:"username"`
	Password     string           `json:"password"`
	PasswordHash string           `json:"password_hash"`
	CookieSecure *bool            `json:"cookie_secure"`
	BruteForce   BruteForceConfig `json:"brute_force"`
}

AuthConfig holds web login authentication credentials read from the module config. Configure either Password (development plaintext) or PasswordHash (bcrypt, production).

type BruteForceConfig

type BruteForceConfig struct {
	// Enabled turns protection on when true or omitted (nil). Set false to disable.
	Enabled *bool `json:"enabled"`
	// MaxAttempts is when progressive delay starts (0 = default 5).
	MaxAttempts int64 `json:"max_attempts"`
	// LockoutAttempts is when full lockout starts (0 = default 10).
	LockoutAttempts int64 `json:"lockout_attempts"`
	// LockoutDuration is how long lockout lasts (empty = default 15m).
	LockoutDuration string `json:"lockout_duration"`
	// WindowDuration is the sliding window for attempt counts (empty = default 15m).
	WindowDuration string `json:"window_duration"`
}

BruteForceConfig holds brute force protection settings for the login endpoint.

Jump to

Keyboard shortcuts

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