middleware

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootRole = 100
)

Variables

This section is empty.

Functions

func Chain

func Chain(h http.Handler, middlewares ...Middleware) http.Handler

func Extract

func Extract(r *http.Request, withAuth bool) (internal.BaseConfig, internal.Auth, error)

func ValidateAuthKey

func ValidateAuthKey(datastore internal.Persister, volatile internal.PubSuber, ctx context.Context, key string) (internal.Auth, error)

func ValidateRootToken

func ValidateRootToken(datastore internal.Persister, base, token string) (internal.Token, error)

Types

type BillingPortalGetter added in v1.4.0

type BillingPortalGetter func(customerID string) (string, error)

type ContextKey

type ContextKey int
const (
	ContextAuth ContextKey = iota
	ContextBase
)

type Middleware

type Middleware func(h http.Handler) http.Handler

func Cors

func Cors() Middleware

Cors enables calls via remote origin to handle external JavaScript calls mainly.

func RequireAuth

func RequireAuth(datastore internal.Persister, volatile internal.PubSuber) Middleware

func RequireRoot

func RequireRoot(datastore internal.Persister, volatile internal.PubSuber) Middleware

func WithDB

func WithDB(datastore internal.Persister, volatile internal.PubSuber, g BillingPortalGetter) Middleware

Jump to

Keyboard shortcuts

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