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

adminhttp

package
v0.3.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: 8 Imported by: 0

Documentation

Overview

Package adminhttp protects browser-based operational endpoints independently of business authentication and CORS settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Protect

func Protect(next http.Handler, cfg Config) (http.Handler, error)

Protect applies Basic Auth, CSRF protection and same-origin read access. Native clients without browser-origin headers still require credentials. The wrapped handler may set a stricter Content-Security-Policy.

Types

type Config

type Config struct {
	Realm    string
	Username string
	Password string `json:"-"`
}

Config supplies a separate administrative account. Serve over HTTPS in production.

func (Config) Validate

func (c Config) Validate() error

Jump to

Keyboard shortcuts

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