basic_auth

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(accounts Accounts) app.HandlerFunc

BasicAuth is a constructor of BasicAuth verifier to hertz middleware It returns a Basic HTTP Authorization middleware. It takes as argument a map[string]string where the key is the username and the value is the password.

func BasicAuthForRealm

func BasicAuthForRealm(accounts Accounts, realm, userKey string) app.HandlerFunc

BasicAuthForRealm returns a Basic HTTP Authorization middleware. It takes as arguments a map[string]string where the key is the username and the value is the password, as well as the name of the Realm. If the realm is empty, "Authorization Required" will be used by default. (see http://tools.ietf.org/html/rfc2617#section-1.2)

Types

type Accounts

type Accounts map[string]string

Accounts is an alias to map[string]string, construct with {"username":"password"}

Jump to

Keyboard shortcuts

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