Documentation ¶
Index ¶
- Variables
- func KeyFromCookie(name string) func(*app.RequestContext) (string, error)
- func KeyFromForm(param string) func(*app.RequestContext) (string, error)
- func KeyFromHeader(header, authScheme string) func(*app.RequestContext) (string, error)
- func KeyFromParam(param string) func(*app.RequestContext) (string, error)
- func KeyFromQuery(param string) func(*app.RequestContext) (string, error)
- func New(opts ...Option) app.HandlerFunc
- type KeyAuthErrorHandler
- type KeyAuthFilterHandler
- type KeyAuthValidatorHandler
- type Option
- type Options
- type QueryFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMissingOrMalformedAPIKey = errors.New("missing or malformed API Key")
ErrMissingOrMalformedAPIKey When there is no request of the key thrown ErrMissingOrMalformedAPIKey
Functions ¶
func KeyFromCookie ¶
func KeyFromCookie(name string) func(*app.RequestContext) (string, error)
KeyFromCookie returns a function that extracts api key from the named cookie.
func KeyFromForm ¶
func KeyFromForm(param string) func(*app.RequestContext) (string, error)
KeyFromForm returns a function that extracts api key from the form.
func KeyFromHeader ¶
func KeyFromHeader(header, authScheme string) func(*app.RequestContext) (string, error)
KeyFromHeader returns a function that extracts api key from the request header.
func KeyFromParam ¶
func KeyFromParam(param string) func(*app.RequestContext) (string, error)
KeyFromParam returns a function that extracts api key from the url param string.
func KeyFromQuery ¶
func KeyFromQuery(param string) func(*app.RequestContext) (string, error)
KeyFromQuery returns a function that extracts api key from the query string.
func New ¶
func New(opts ...Option) app.HandlerFunc
Types ¶
type KeyAuthErrorHandler ¶
type KeyAuthErrorHandler func(context.Context, *app.RequestContext, error)
type KeyAuthFilterHandler ¶
type KeyAuthFilterHandler func(c context.Context, ctx *app.RequestContext) bool
type KeyAuthValidatorHandler ¶
type Option ¶
type Option struct {
F func(o *Options)
}
Option is the only struct that can be used to set Options.
func WithContextKey ¶
func WithErrorHandler ¶
func WithErrorHandler(f KeyAuthErrorHandler) Option
func WithFilter ¶
func WithFilter(f KeyAuthFilterHandler) Option
func WithKeyLookUp ¶
func WithSuccessHandler ¶
func WithSuccessHandler(f app.HandlerFunc) Option
func WithValidator ¶
func WithValidator(f KeyAuthValidatorHandler) Option
Click to show internal directories.
Click to hide internal directories.