auth

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiBasicAuth added in v0.0.8

func ApiBasicAuth(db ApiUserRepository) func(next http.Handler) http.Handler

ApiBasicAuth will check the basic auth credentials sent in the request against the known users, and return a JSON response if authentication has failed.

func BrowserBasicAuth added in v0.0.8

func BrowserBasicAuth(db ApiUserRepository) func(next http.Handler) http.Handler

BrowserBasicAuth will check the basic auth credentials sent in the request against the known users, and (re)-request basic auth credentials if authentication has failed.

Types

type ApiUser

type ApiUser struct {
	Id       uuid.UUID
	Name     string
	Password []byte
}

func NewApiUser

func NewApiUser(id uuid.UUID, name string, password []byte) ApiUser

func (ApiUser) CheckPassword

func (u ApiUser) CheckPassword(password string) error

type ApiUserRepository

type ApiUserRepository interface {
	GetApiUsers() ([]ApiUser, error)
	GetApiUserById(id uuid.UUID) (ApiUser, error)
	GetApiUserByName(name string) (ApiUser, error)
	SetApiUser(a ApiUser) error
	DeleteApiUserById(id uuid.UUID) error
}

Jump to

Keyboard shortcuts

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