middleware

package
v1.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidToken is returned when the request token is invalid.
	ErrInvalidToken = "invalid or missing token"
)

Functions

func Auth

func Auth(opts ...account.Option) func(http.Handler) http.Handler

Auth provides a middleware to authenticate requests using the x-access-token header value and write it to the context. If there is no x-access-token the middleware prevents access and renders a json document.

func RequireAdmin

func RequireAdmin(rm *roles.Manager, logger log.Logger) func(next http.Handler) http.Handler

RequireAdmin middleware is used to require the user in context to be an admin / have account management permissions

func Token

func Token(token string) func(http.Handler) http.Handler

Token provides a middleware to check access secured by a static token.

Types

This section is empty.

Jump to

Keyboard shortcuts

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