Documentation
¶
Overview ¶
Package transport is the common HTTP boundary. Business handlers remain in their module and perform resource-specific checks through their services.
Index ¶
- Variables
- func JSON(w http.ResponseWriter, status int, value any)
- func NewHandler(registry *module.Registry, routes []Route, authn Authenticator, ...) (handler http.Handler, err error)
- func RequestID(ctx context.Context) string
- type Access
- type Authenticator
- type Authorizer
- type Error
- type Principal
- type Resource
- type Route
- type SourceLimiter
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnauthenticated = errors.New("authentication required") ErrForbidden = errors.New("permission denied") )
Functions ¶
func NewHandler ¶
func NewHandler(registry *module.Registry, routes []Route, authn Authenticator, authz Authorizer, logger *slog.Logger) (handler http.Handler, err error)
NewHandler rejects ambiguous registrations and requires explicit public or protected access. An absent identity adapter never implies anonymous access.
Types ¶
type Authenticator ¶
type Authorizer ¶
type SourceLimiter ¶ added in v0.2.0
SourceLimiter bounds anonymous reads per source within a fixed window. A full table rejects new sources until expired entries can be reclaimed.
func (*SourceLimiter) Allow ¶ added in v0.2.0
func (l *SourceLimiter) Allow(source string) bool