bauth

package
v0.0.0-...-10dc113 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultBasicAuthConfig is the default BasicAuth middleware config.
	DefaultBasicAuthConfig = BasicAuthConfig{
		Skipper: skipper.DefaultSkipper,
	}
)

Functions

func BasicAuth

func BasicAuth(fn BasicAuthValidator) makross.Handler

BasicAuth returns an BasicAuth middleware.

For valid credentials it calls the next handler. For invalid credentials, it sends "401 - Unauthorized" response. For empty or invalid `Authorization` header, it sends "400 - Bad Request" response.

func BasicAuthWithConfig

func BasicAuthWithConfig(config BasicAuthConfig) makross.Handler

BasicAuthWithConfig returns an BasicAuth middleware with config. See `BasicAuth()`.

Types

type BasicAuthConfig

type BasicAuthConfig struct {
	// Skipper defines a function to skip middleware.
	Skipper skipper.Skipper

	// Validator is a function to validate BasicAuth credentials.
	// Required.
	Validator BasicAuthValidator
}

BasicAuthConfig defines the config for BasicAuth middleware.

type BasicAuthValidator

type BasicAuthValidator func(string, string) bool

BasicAuthValidator defines a function to validate BasicAuth credentials.

Jump to

Keyboard shortcuts

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