Documentation
¶
Index ¶
- func CreatePasswordHash(password string) ([]byte, error)
- type Authentication
- type AuthenticationType
- type FileAuth
- func (fileAuth *FileAuth) AddUser(username string, httpPassHash string, smtpPassHash string) error
- func (fileAuth *FileAuth) Authenticate(authType AuthenticationType, username string, password string) bool
- func (fileAuth *FileAuth) DeleteUser(username string) error
- func (fileAuth *FileAuth) ListUsers(searchQuery string, offset, limit int) ([]UserResource, int, error)
- func (fileAuth *FileAuth) RequiresAuthentication() bool
- func (fileAuth *FileAuth) UpdateUser(username string, httpPassHash string, smtpPassHash string) error
- func (fileAuth *FileAuth) UsernamePresent(username string) bool
- type Mongo
- func (mongoClient *Mongo) AddUser(username string, httpPassHash string, smtpPassHash string) error
- func (mongoClient *Mongo) Authenticate(authType AuthenticationType, username string, password string) bool
- func (mongoClient *Mongo) DeleteUser(username string) error
- func (mongoClient *Mongo) ListUsers(searchQuery string, offset, limit int) ([]UserResource, int, error)
- func (mongoClient *Mongo) RequiresAuthentication() bool
- func (mongoClient *Mongo) UpdateUser(username string, httpPassHash string, smtpPassHash string) error
- func (mongoClient *Mongo) UsernamePresent(username string) bool
- type UserResource
- type UserRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreatePasswordHash ¶ added in v1.0.17
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
// UsernamePresent check is username exists
UsernamePresent(username string) bool
// AddUser to auth storage
AddUser(username string, httpPassHash string, smtpPassHash string) error
// UpdateUser in auth storage
UpdateUser(username string, httpPassHash string, smtpPassHash string) error
// DeleteUser from auth storage
DeleteUser(username string) error
// ListUsers from auth storage
ListUsers(searchQuery string, offset, limit int) ([]UserResource, int, error)
}
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 (*FileAuth) Authenticate ¶
func (fileAuth *FileAuth) Authenticate(authType AuthenticationType, username string, password string) bool
func (*FileAuth) DeleteUser ¶ added in v1.0.17
func (*FileAuth) RequiresAuthentication ¶
func (*FileAuth) UpdateUser ¶ added in v1.0.17
func (*FileAuth) UsernamePresent ¶
type Mongo ¶ added in v1.0.16
type Mongo struct {
Collection *mongo.Collection
}
func CreateMongoDbAuthentication ¶ added in v1.0.16
func CreateMongoDbAuthentication(collection *mongo.Collection) *Mongo
func (*Mongo) Authenticate ¶ added in v1.0.16
func (mongoClient *Mongo) Authenticate(authType AuthenticationType, username string, password string) bool
func (*Mongo) DeleteUser ¶ added in v1.0.17
func (*Mongo) RequiresAuthentication ¶ added in v1.0.16
func (*Mongo) UpdateUser ¶ added in v1.0.17
func (*Mongo) UsernamePresent ¶ added in v1.0.16
type UserResource ¶ added in v1.0.17
type UserResource struct {
Username string
}
Click to show internal directories.
Click to hide internal directories.