httpauth

package
v1.66.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

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

Arg captures path components and attaches them to the request context. It always captures a non-empty component.

func (*Arg) Capture

func (a *Arg) Capture(h http.Handler) http.Handler

Capture consumes a path component and stores it in the request context so that it can be retreived with Value.

func (*Arg) Value

func (a *Arg) Value(ctx context.Context) string

Value returns the value associated with the Arg on the context.

type Dir

type Dir map[string]http.Handler

Dir pulls off path components from the front of the path and dispatches. It attempts to dispatch to "*" without consuming a path component if nothing matches.

func (Dir) ServeHTTP

func (d Dir) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements the http.Handler interface.

type Method

type Method map[string]http.Handler

Method checks the request method and dispatches.

func (Method) ServeHTTP

func (m Method) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements the http.Handler interface.

type Resources

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

Resources wrap a database and expose methods over HTTP.

func New

func New(
	log *zap.Logger,
	db *authdb.Database,
	endpoint *url.URL,
	authToken []string,
	postSizeLimit memory.Size,
) *Resources

New constructs Resources for some database. If getAccessRL is nil then GetAccess endpoint won't be rate-limited.

func (*Resources) ServeHTTP

func (res *Resources) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP makes Resources an http.Handler.

func (*Resources) SetShutdown

func (res *Resources) SetShutdown()

SetShutdown sets the inShutdown status flag to true indicating the server is shutting down.

func (*Resources) SetStartupDone

func (res *Resources) SetStartupDone()

SetStartupDone sets the startup status flag to true indicating startup is complete.

Jump to

Keyboard shortcuts

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