httpauth

package
v0.0.0-...-5559093 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package httpauth handles HTTP Basic authentication with supplied authentication functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBasicAuthFromRequest

func GetBasicAuthFromRequest(r *http.Request) (string, string, error)

GetBasicAuthFromRequest returns basic auth username and password given a `*http.Request`

Types

type AuthProvider

type AuthProvider func(username string, password string, r *http.Request) (string, bool)

AuthProvider is a function that given a username, password and request, authenticates the user.

type BasicAuthHandler

type BasicAuthHandler struct {
	Handler    http.Handler
	RemoveAuth bool

	*BasicAuthWrapper
}

BasicAuthHandler needs a comment

func (*BasicAuthHandler) ServeHTTP

func (b *BasicAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP Satisfies the http.Handler interface for basicAuth.

type BasicAuthWrapper

type BasicAuthWrapper struct {
	Cache               *cache.Cache
	Realm               string
	Logger              *zap.Logger
	AuthFunc            AuthProvider
	UnauthorizedHandler http.Handler
	CacheDuration       time.Duration
}

BasicAuthWrapper needs a comment

Jump to

Keyboard shortcuts

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