static function authenticator($context = 'gb-admin') { if (self::$_authenticators === null) { self::$_authenticators = array(); } elseif (isset(self::$_authenticators[$context])) { return self::$_authenticators[$context]; } $users = array(); foreach (GBUser::find() as $email => $account) { # only include actual users if (strpos($email, '@') !== false) { $users[$email] = $account->passhash; } } $chap = new CHAP($users, $context); self::$_authenticators[$context] = $chap; return $chap; }