auth

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package auth is the only way apps learn who is calling (docs/adr/0004-tailscale-identity-via-caddy.md). Identity arrives as Tailscale-User-* headers set by the edge proxy; the Tailscale ACL guarantees nothing else can reach an app port (ADR-0011).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(next http.Handler) http.Handler

Middleware rejects requests without an identity header and stores the User in the request context. For local development, set BESPOKE_DEV_USER to bypass the edge proxy (e.g. BESPOKE_DEV_USER=me@github).

Types

type User

type User struct {
	Login string // e.g. "bketelsen@github" — stable identifier
	Name  string // display name; falls back to Login
}

func FromContext

func FromContext(ctx context.Context) User

FromContext returns the authenticated user. It panics if the handler was not wrapped by Middleware — that is a wiring bug, not a runtime condition.

Jump to

Keyboard shortcuts

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