Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotConnected = fmt.Errorf("database not connected")
)
Functions ¶
func CheckPassword ¶
CheckPassword checks if the hash was the result of hashing this specific plainPassword
func HashPassword ¶
HashPassword hashes the plainPassword using the bcrypt.DefaultCost
Types ¶
type AuthStore ¶
type AuthStore interface { // Authenticate attempts to authenticate the given credentials Authenticate(username, plainPassword string) (success bool, err error) // CreateUser creates a user with the given username CreateUser(username, plainPassword string) error // ResetPassword resets the password for the given username ResetPassword(username, plainPassword string) error // ListUsers lists all information about the users // TODO: this could be very neat for the sysadmin, but probably a lot of metadata // about users is desired, and not just the usernames. ListUsers() (usernames []string, err error) // DeleteUser removes the username from the database entirely DeleteUser(username string) error }
AuthStore contacts the backend to query about the users. It is used for database interaction only.
type DummyAuthBackend ¶
type DummyAuthBackend struct { }
func (DummyAuthBackend) Authenticate ¶
func (d DummyAuthBackend) Authenticate(u, p string) (bool, error)
func (DummyAuthBackend) CreateUser ¶
func (d DummyAuthBackend) CreateUser(u, p string) error
func (DummyAuthBackend) DeleteUser ¶
func (d DummyAuthBackend) DeleteUser(u string) error
func (DummyAuthBackend) ListUsers ¶
func (d DummyAuthBackend) ListUsers() ([]string, error)
func (DummyAuthBackend) ResetPassword ¶
func (d DummyAuthBackend) ResetPassword(u, p string) error
Directories ¶
Path | Synopsis |
---|---|
Package boltstore holds an implementation of github.com/alienscience/imapsrv/auth - AuthStore, using github.com/boltdb/bolt - DB.
|
Package boltstore holds an implementation of github.com/alienscience/imapsrv/auth - AuthStore, using github.com/boltdb/bolt - DB. |
Package mysqlstore holds an implementation of github.com/alienscience/imapsrv/auth - AuthStore, using MySQL
|
Package mysqlstore holds an implementation of github.com/alienscience/imapsrv/auth - AuthStore, using MySQL |
Click to show internal directories.
Click to hide internal directories.