1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-08 17:51:57 +00:00

auth: Implement an Authenticator type

This patch implements an Authenticator type, which connections use to
do authentication and user existence checks.

It simplifies the abstractions (the server doesn't need to know about
userdb, or keep track of domain-userdb maps), and lays the foundation
for other types of authentication backends which will come in later
patches.
This commit is contained in:
Alberto Bertogli
2018-01-29 21:55:34 +00:00
parent 08e6f57d2e
commit d4992ef8c5
6 changed files with 368 additions and 73 deletions

View File

@@ -178,8 +178,8 @@ func (db *DB) RemoveUser(name string) bool {
return present
}
// HasUser returns true if the user is present, False otherwise.
func (db *DB) HasUser(name string) bool {
// Exists returns true if the user is present, False otherwise.
func (db *DB) Exists(name string) bool {
db.mu.Lock()
_, present := db.db.Users[name]
db.mu.Unlock()