middleware

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DynoIDKey ctxKeyDynoID = iota
	DynoIDErrKey
)

Variables

View Source
var (
	ErrTokenMissing = errors.New("token not found")
)

Functions

func AddToContext

func AddToContext(ctx context.Context, token *dynoid.Token, err error) context.Context

AddToContext adds the Token to the given context

func Authorize

func Authorize(audience string, callback dynoid.IssuerCallback) func(http.Handler) http.Handler

Authorize populates the dyno identity blocks requests where the callback fails.

func AuthorizeSameSpace

func AuthorizeSameSpace(audience string) func(http.Handler) http.Handler

AuthorizeSameSpace restricts access to tokens from the same space/issuer for the given audience.

func AuthorizeSpaces

func AuthorizeSpaces(audience, host string, spaces ...string) func(http.Handler) http.Handler

AuthorizeSpace populates the dyno identity and blocks any requests that aren't from one of the given spaces.

func FromContext

func FromContext(ctx context.Context) (*dynoid.Token, error)

FromContext fetches the Token from the context

func Populate

func Populate(audience string, callback dynoid.IssuerCallback) func(http.Handler) http.Handler

Populate attempts to validate and parse a Token from the request for the given audience but doesn't enforce any restrictions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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