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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user