// Check authenticates the client using a username and password against a list of multiple users. func (m *MultiUser) Check(c server.ClientAuth) bool { opts := c.GetOpts() user, ok := m.users[opts.Username] if !ok { return false } pass := user.Password // Check to see if the password is a bcrypt hash if isBcrypt(pass) { if err := bcrypt.CompareHashAndPassword([]byte(pass), []byte(opts.Password)); err != nil { return false } } else if pass != opts.Password { return false } c.RegisterUser(user) return true }