basicauth

package
v0.0.0-...-5d7ca49 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicAuthProvider

type BasicAuthProvider struct {
	CredentialMap   map[string]string
	PasswordService auth.IPasswordService
}

BasicAuthProvider offers in interface for authenticating users with basic user name and password. These credentials are stored in the config file. They are hashed for security reasons.

func (*BasicAuthProvider) Login

func (p *BasicAuthProvider) Login(credentials *auth.AuthCredentials) error

Login returns an error if the credential provided are invalid

type MockPasswordService

type MockPasswordService struct {
	FnIsPasswordValid func([]byte, []byte) bool
}

func (*MockPasswordService) IsPasswordValid

func (m *MockPasswordService) IsPasswordValid(password, storedPassword []byte) bool

type PasswordService

type PasswordService struct{}

PasswordService provides methods for working with passwords

func (*PasswordService) HashPassword

func (s *PasswordService) HashPassword(password []byte) ([]byte, error)

HashPassword hashes a password

func (*PasswordService) IsPasswordValid

func (s *PasswordService) IsPasswordValid(password, storedPassword []byte) bool

IsPasswordValid returns true if the provided password matches the stored password

Jump to

Keyboard shortcuts

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