devheaders

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package devheaders provides devheaders utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled         bool
	UserIDHeader    string
	EmailHeader     string
	FirstNameHeader string
	LastNameHeader  string
	DefaultLanguage string
}

Config controls dev header-based auth.

func LoadConfig

func LoadConfig(loader *config.Loader) Config

LoadConfig reads dev-auth header config from environment.

type Middleware

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

Middleware injects an auth subject in local environments without a JWT provider.

func New

func New(cfg Config, log ports.Logger) (*Middleware, error)

New constructs the middleware.

func (*Middleware) Handler

func (m *Middleware) Handler(next http.Handler) http.Handler

Handler attaches a subject from debug headers if JWT auth is disabled.

func (*Middleware) OptionalHandler

func (m *Middleware) OptionalHandler(next http.Handler) http.Handler

OptionalHandler attaches a subject from debug headers if present, otherwise allows anonymous access.

Jump to

Keyboard shortcuts

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