Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicAuth ¶
type BasicAuth struct { Realm string Users map[string]AuthUser AuthFunc func(string, string, *http.Request) bool }
BasicAuth provides HTTP middleware for protecting URIs with HTTP Basic Authentication as per RFC 2617. The server authenticates a user:password combination provided in the "Authorization" HTTP header.
Note: HTTP Basic Authentication credentials are sent in plain text, and therefore it does not make for a wholly secure authentication mechanism. You should serve your content over HTTPS to mitigate this, noting that "Basic Authentication" is meant to be just that: basic!
func SimpleBasicAuth ¶
SimpleBasicAuth takes a map with usernames and corresponding passwords, and returns a BasicAuth struct that can be used as middleware to handle basic user autentication.
func (BasicAuth) Authenticate ¶
func (b BasicAuth) Authenticate(handler http.HandlerFunc) http.HandlerFunc
Authenticate is a middleware function that adds HTTP BasicAuth to a http handler
type Firewall ¶
type Firewall struct { Blacklisting bool Subpath bool Rules map[string][]string ErrorHandler router.ErrorHandler }
Firewall is type that holds multiple middleware functions to add a firewall to http handlers
func (*Firewall) BlockHTTP ¶
func (f *Firewall) BlockHTTP(handler http.HandlerFunc) http.HandlerFunc
BlockHTTP is a middleware function to add a firewall to HTTP handlers
func (*Firewall) BlockProxy ¶
func (f *Firewall) BlockProxy(handler http.HandlerFunc) http.HandlerFunc
BlockProxy is a middleware function to add a firewall to HTTP proxy
type Limiter ¶
type Limiter struct { RatePerSec rate.Limit RateBurst int ErrorHandler router.ErrorHandler FilterOnIP bool // contains filtered or unexported fields }
Limiter is a type containing a MaguroHTTP Guard limiter
func NewLimiter ¶
NewLimiter returns a new guard.Limiter
func (*Limiter) LimitHTTP ¶
func (l *Limiter) LimitHTTP(h http.HandlerFunc) http.HandlerFunc
LimitHTTP is a HTTP middleware function that can be used to add rate limiting to HTTP handlers.