middleware

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BearerToken

type BearerToken = []byte

func GetBearerToken

func GetBearerToken(r *http.Request) (BearerToken, error)

GetBearerToken ...

type Error

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

type Middleware

type Middleware struct {
	Client *client.Client
	// UserDomain domain.UserDomainInterface
	Log       log.LoggerInterface
	IpLogRepo database.IpLogRepositoryInterface
}

Middleware is a helper for route to validate a http Request

func NewAdapter

func NewAdapter(d Middleware) Middleware

func (Middleware) AccessToken

func (m Middleware) AccessToken(w http.ResponseWriter, r *http.Request) (*http.Request, *Error)

func (Middleware) ApiToken

func (m Middleware) ApiToken(w http.ResponseWriter, r *http.Request) (*http.Request, *Error)

func (Middleware) Cors

Cors is a middleware to handle Cross Origin Request

func (Middleware) Do

func (Middleware) Group

func (m Middleware) Group(h http.Handler, verifyAll bool, handlers ...MiddlewareFunc) http.HandlerFunc

Group is Helper for executes bunch of middleware

func (Middleware) Guest

func (m Middleware) Guest(h http.Handler) http.HandlerFunc

func (Middleware) IpLogging added in v1.1.0

func (m Middleware) IpLogging(h http.Handler) http.HandlerFunc

func (Middleware) Verify

func (m Middleware) Verify(h http.Handler, handlers ...MiddlewareFunc) http.HandlerFunc

Verify is helper for executes list of middleware from routes

type MiddlewareFunc

type MiddlewareFunc = func(w http.ResponseWriter, r *http.Request) (*http.Request, *Error)

Jump to

Keyboard shortcuts

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