basicauth

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package basicauth supply basicAuth middleware abstraction

Index

Constants

View Source
const HeaderAuth = "Authorization"

HeaderAuth is common auth header

Variables

View Source
var (
	ErrInvalidBase64 = errors.New("invalid base64")
	ErrNoHeader      = errors.New("not authorized")
	ErrInvalidAuth   = errors.New("invalid authentication")
)

errors

Functions

func Use

func Use(middleware *BasicAuth)

Use put a custom basic auth logic then register handler to chassis

Types

type BasicAuth

type BasicAuth struct {
	Realm string //required

	Authenticate func(user, pwd string) error               //required
	Authorize    func(user string, req *http.Request) error //optional

}

BasicAuth should implement basic auth server side logic it is singleton

type Handler

type Handler struct {
}

Handler is is a basic auth pre process raw data in handler

func (*Handler) Handle

Handle pre process raw data in handler

func (*Handler) Name

func (ph *Handler) Name() string

Name returns the router string

Jump to

Keyboard shortcuts

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