web

package
v0.97.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 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.0

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 sets the cache backend for the login rate limiter. Must be called after Init if BruteForce is enabled.

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         bool   `json:"enabled"`
	MaxAttempts     int64  `json:"max_attempts"`
	LockoutAttempts int64  `json:"lockout_attempts"`
	LockoutDuration string `json:"lockout_duration"`
	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