middleware

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRequestUser

func GetRequestUser(r *http.Request) *auth.User

Types

type Auth

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

func NewAuth

func NewAuth(cfg *AuthConfig, authen Authenticator, authz Authorizer) *Auth

func (*Auth) Authenticate

func (a *Auth) Authenticate(username, password string) (bool, error)

func (*Auth) Authorize

func (a *Auth) Authorize(r *http.Request) (bool, error)

func (*Auth) Middleware

func (a *Auth) Middleware(handler http.Handler) http.Handler

type AuthMiddleware

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

func (*AuthMiddleware) Authenticate

func (mw *AuthMiddleware) Authenticate(w http.ResponseWriter, r *http.Request) (*http.Request, error)

func (*AuthMiddleware) Authorize

func (mw *AuthMiddleware) Authorize(w http.ResponseWriter, r *http.Request) error

func (*AuthMiddleware) ServeHTTP

func (mw *AuthMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Authenticator

type Authenticator interface {
	Authenticate(username, password string) (bool, error)
}

type Authorizer

type Authorizer interface {
	Authorize(req *http.Request) (bool, error)
}

Jump to

Keyboard shortcuts

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