basic

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Basic authentication provides a simple username/password authentication passed in authentication header.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingCredentials = errors.New("no credentials provided in request")
	ErrBadCredentials     = errors.New("bad username or password")
)

Functions

This section is empty.

Types

type Basic

type Basic struct {
	BasicMiddleware
	Username string
	Password string
}

Basic is a rudimentary backend for auth. It uses a username and password to authenticate the user. The password is generated if not provided.

func NewBasic

func NewBasic(username string, password *string) *Basic

NewBasic creates a new Basic backend. If password is nil, a random password is generated and sent to the logs.

type BasicMiddleware

type BasicMiddleware struct {
	Basic *Basic
}

func (BasicMiddleware) AuthMiddleware

func (a BasicMiddleware) AuthMiddleware(next http.Handler) http.Handler

AuthMiddleware is a middleware that checks the authentication of the user

Jump to

Keyboard shortcuts

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