Revision: 24280
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 25, 2010 06:01 by rccc
Initial Code
public function preExecute() { $this->checkBasicAuth(); } protected function sendHeadersAndExit () { header('WWW-Authenticate: Basic realm="Acces restreint"'); header('HTTP/1.0 401 Unauthorized'); header('Content-Type: text/html; charset=utf-8'); exit(); } protected function checkBasicAuth() { if($this->getUser()->isAuthenticated() && $this->getUser()->hasAttribute('user_id')) return true; if (!isset($_SERVER['PHP_AUTH_USER'])) { $this->sendHeadersAndExit(); } $group = ParameterPeer::get('contributeur_groupe_id'); if ( !$member = MemberPeer::authCheckTrickSpace($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $group) ) { $this->sendHeadersAndExit(); } else { $this->getUser()->setAttribute('member_id', $member->getId()); $this->getUser()->setAuthenticated(true); } }
Initial URL
Initial Description
Initial Title
Symfony HTTP AUTH
Initial Tags
Initial Language
PHP