func BasicAuth(fn BasicAuthValidator) nio.MiddlewareFunc {
	c := DefaultBasicAuthConfig
	c.Validator = fn
	return BasicAuthWithConfig(c)
}
BasicAuth returns an BasicAuth middleware.

For valid credentials it calls the next handler.
For missing or invalid credentials, it sends "401 - Unauthorized" response.
package mw
import (
	"encoding/base64"
	"strconv"
	"strings"
	"github.com/go-nio/nio"
)
type (
	BasicAuthConfig struct {
		Skipper nio.Skipper
		Validator BasicAuthValidator
		Realm string
	}
	BasicAuthValidator func(string, string, nio.Context) (bool, error)
)
const (
	basic        = "basic"
	defaultRealm = "Restricted"
)
var (
	DefaultBasicAuthConfig = BasicAuthConfig{
		Skipper: nio.DefaultSkipper,
		Realm:   defaultRealm,
	}
)