authentication

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: MIT-0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication interface {
	// RequiresAuthentication check is supports auth
	RequiresAuthentication() bool
	// Authenticate check is credentials valid
	Authenticate(authType AuthenticationType, username string, password string) bool
}

Authentication interface represents a backend flow to store or retrieve messages

type AuthenticationType

type AuthenticationType = string
const (
	HTTP AuthenticationType = "http"
	SMTP                    = "smtp"
)

type FileAuth

type FileAuth struct {
	// contains filtered or unexported fields
}

FileAuth represents the authentication handler using file

func CreateFileAuthentication

func CreateFileAuthentication(authFilePath string) *FileAuth

func (*FileAuth) AddUser

func (fileAuth *FileAuth) AddUser(username string, httpPassHash string, smtpPassHash string) error

func (*FileAuth) AuthFile

func (fileAuth *FileAuth) AuthFile(path string) int

AuthFile scan file and add users to memory

func (*FileAuth) Authenticate

func (fileAuth *FileAuth) Authenticate(authType AuthenticationType, username string, password string) bool

func (*FileAuth) RequiresAuthentication

func (fileAuth *FileAuth) RequiresAuthentication() bool

func (*FileAuth) UsernamePresent

func (fileAuth *FileAuth) UsernamePresent(username string) bool

func (*FileAuth) WriteToFile

func (fileAuth *FileAuth) WriteToFile(file *os.File) error

Jump to

Keyboard shortcuts

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