httpauth

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package httpauth provides fail-closed net/http authorization integration.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilAuthorizer    = errors.New("HTTP authorization authorizer is nil")
	ErrNilRequestMapper = errors.New("HTTP authorization request mapper is nil")
	ErrNilNextHandler   = errors.New("HTTP authorization next handler is nil")
)

Functions

func DecisionFromContext

func DecisionFromContext(ctx context.Context) (authorization.Decision, bool)

func ErrorFromContext

func ErrorFromContext(ctx context.Context) (error, bool)

func NewHandler

func NewHandler(
	authorizer Authorizer,
	mapper RequestMapper,
	next http.Handler,
	handlerOptions ...Option,
) (http.Handler, error)

NewHandler maps each HTTP request, evaluates it, and invokes next only for explicit allow decisions. Mapper and evaluation failures use the error handler; deny and not-applicable outcomes use the denial handler.

Types

type Authorizer

type Authorizer interface {
	Decide(context.Context, authorization.Request) (authorization.Decision, error)
}

type Option

type Option func(*options)

func WithDeniedHandler

func WithDeniedHandler(handler http.Handler) Option

func WithErrorHandler

func WithErrorHandler(handler http.Handler) Option

type RequestMapper

type RequestMapper func(*http.Request) (authorization.Request, error)

Jump to

Keyboard shortcuts

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