/** * Execute filter * * Checks to see if the http auth provided credentials matches a * user in the database and if not prompts for login information. * * @param sfFilterChain $filterChain */ public function execute($filterChain) { if (!isset($_SERVER['PHP_AUTH_USER'])) { $this->sendHeadersAndExit(); } // Attempt to sign in the user via http auth. $form = new sfGuardFormSignin(null, array(), false); $form->bind(array('username' => $_SERVER['PHP_AUTH_USER'], 'password' => $_SERVER['PHP_AUTH_PW'])); if (!$form->isValid()) { $this->sendHeadersAndExit(); } // Sign in the current user using the values returned from the form. $this->getContext()->getUser()->signIn($form->getValue('user')); parent::execute($filterChain); }