maddy/internal/module/auth.go
fox.cpp e19d21dfcb
Fully separate authentication from IMAP access
Now imapsql module does not handle authentication. (it was not doing it so well
anyway)

sql_table module was introduced and used in the default configuration as
a replacement for functionality that was implemented by imapsql before.

Parts of maddyctl code were rewritten to make it work transparently with
any IMAP backend or credentials store.

Closes #212.
2020-04-14 00:06:47 +03:00

26 lines
745 B
Go

package module
import "errors"
var (
// ErrUnknownCredentials should be returned by auth. provider if supplied
// credentials are valid for it but are not recognized (e.g. not found in
// used DB).
ErrUnknownCredentials = errors.New("unknown credentials")
)
// PlainAuth is the interface implemented by modules providing authentication using
// username:password pairs.
type PlainAuth interface {
AuthPlain(username, password string) error
}
// PlainUserDB is a local credentials store that can be managed using maddyctl
// utility.
type PlainUserDB interface {
PlainAuth
ListUsers() ([]string, error)
CreateUser(username, password string) error
SetUserPassword(username, password string) error
DeleteUser(username string) error
}