htpasswd

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidUser             = errors.New("user is invalid")
	ErrFailedToParseBasicAuth  = errors.New("the provided basic authentication credentials are invalid")
	ErrMetadataNotFound        = errors.New("metadata not found")
	ErrAuthHeaderNotFound      = errors.New("authorization header not found")
	ErrFailedToDecodeBasicAuth = errors.New("failed to decode authorization header")
	ErrAuthHeaderInvalidFormat = errors.New("invalid authorization header format")
	ErrInvalidPassword         = errors.New("password is invalid")
)

Functions

func CompareBasicAuth

func CompareBasicAuth(storedCredential, user, password string) error

CompareBasicAuth compares a stored credential (username:password_hash) with a provided username and password. It uses bcrypt to securely compare the password hash stored in the credential with the provided password.

func ExtractBasicAuth added in v1.2.0

func ExtractBasicAuth(basicAuthCredential string) (user, password string, err error)

ExtractBasicAuth extracts the user and password or password hash from the given basic auth credential. The credential should be in the form "user:password" or "user:password_hahs".

func ExtractBasicAuthFromContext

func ExtractBasicAuthFromContext(ctx context.Context) (user, password string, err error)

ExtractBasicAuthFromContext extracts the user and password from the incoming context in gRPC request.

Types

This section is empty.

Jump to

Keyboard shortcuts

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