name = "authhttpd"; $this->text = _("HTTPD authentication"); $this->pkg_desc = _("This plugin contains an HTTPD authentication mechanism for FusionForge. It allows Apache authentication to be reused for FusionForge, for instance where Kerberos is used."); $this->_addHook('display_auth_form'); $this->_addHook("check_auth_session"); $this->_addHook("fetch_authenticated_user"); $this->_addHook("close_auth_session"); $this->_addHook('session_valid_login'); $this->saved_login = ''; $this->saved_user = NULL; $this->declareConfigVars(); } private static $init = false; /** * Display a form to input credentials * @param array $params * @return boolean */ function displayAuthForm(&$params) { global $HTML; if (!$this->isRequired() && !$this->isSufficient()) { return true; } $return_to = $params['return_to']; $result = html_e('p', array(), _('Cookies must be enabled past this point.')); $result .= $HTML->openForm(array('action' => '/plugins/'.$this->name.'/post-login.php', 'method' => 'get')); $result .= '
'; $result .= $HTML->closeForm(); $params['html_snippets'][$this->name] = $result; $params['transparent_redirect_urls'][$this->name] = util_make_url('/plugins/'.$this->name.'/post-login.php?return_to='.htmlspecialchars(stripslashes($return_to))); } function session_login_valid($params) { $user = user_get_object_by_name($params['loginname']); $this->setAuthStateResult($params, $user); return true; } /** * checkAuthSession - Is there a valid session? * @param array $params */ function checkAuthSession(&$params) { $this->saved_user = NULL; $user = NULL; if (isset($GLOBALS['REMOTE_USER'])) { $username = $GLOBALS['REMOTE_USER']; } else { $username = NULL; } if ($username) { $user = user_get_object_by_name($username); } $this->saved_user = $user; $this->setAuthStateResult($params, $user); } /** * fetchAuthUser - What FFUser is logged in? * @param array $params */ function fetchAuthUser(&$params) { if ($this->saved_user && $this->isSufficient()) { $params['results'] = $this->saved_user; } } function closeAuthSession($params) { // No way to close an HTTPD session from the server, unfortunately return true; } } // Local Variables: // mode: php // c-file-style: "bsd" // End: