authhttpmiddleware

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Configs = configset.Set[Config]{
	Default: &Config{Required: true},
	Dev:     &Config{AllowDefaultUser: true},
	Test:    &Config{AllowDefaultUser: true},
}

Functions

This section is empty.

Types

type AuthHeaderExtractor added in v0.6.9

type AuthHeaderExtractor func(*http.Request) sdktypes.User

func AuthorizationHeaderExtractor added in v0.6.9

func AuthorizationHeaderExtractor(deps Deps) AuthHeaderExtractor

Auth middleware is extracting, parsing and adding user to the request context (see newTokensMiddleware above) Unfortunately the main log is in interceptor, and auth middleware chained several hops after the interceptor handler, where httpRequest is logged. So this function duplicates partly the extraction logic of newTokensMiddleware in order to be applied earlier in chain and log the user passed in the request.

type AuthMiddlewareDecorator

type AuthMiddlewareDecorator func(http.Handler) http.Handler

func New

func New(deps Deps) AuthMiddlewareDecorator

type Config

type Config struct {
	Required         bool `koanf:"required"`
	AllowDefaultUser bool `koanf:"allow_default_user"`
}

type Deps

type Deps struct {
	fx.In

	Cfg      *Config
	Sessions authsessions.Store `optional:"true"`
	Tokens   authtokens.Tokens  `optional:"true"`
}

Jump to

Keyboard shortcuts

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