Source for file HttpAuthFilter.php
Documentation is available at HttpAuthFilter.php
* "THE BEER-WARE LICENSE" (Revision 42):
* "Sven Strittmatter" <ausserirdisch@sven-space.de> wrote this file.
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
* @copyright Copyright (c) 2007 Sven Strittmatter
require_once dirname(__FILE__ ). "/Filter.php";
require_once dirname(__FILE__ ). "/../Event/EventDispatcher.php";
* Enter description here...
* @todo complete description
* @copyright Copyright (c) 2007 Sven Strittmatter
* @author "Sven Strittmatter" <ausserirdisch@sven-space.de>
* @link http://www.sven-space.de/code/php/MVClasses
$this->_auth_data = $auth_data;
public function execute(Request $req, Response $res) {
$auth_data = $req->getAuthData();
if (null === $auth_data) {
$this->_sendAuthRequest($res);
if (!isset ($this->_auth_data[$auth_data['username']]) ||
$this->_auth_data[$auth_data['username']] !== $auth_data['password']) {
$this->_sendAuthRequest($res);
if ($event->isCancelled()) {
$this->_sendAuthRequest($res);
private function _sendAuthRequest(Response $r) {
$r->addHeader("WWW-Authenticate", "Basic realm=\"RealCommunity\"");
|