4 * HTTP Authentication baseclass
6 * This class has the common functionality for BasicAuth and DigestAuth
10 * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
11 * @author Evert Pot (http://www.rooftopsolutions.nl/)
12 * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
14 abstract class Sabre_HTTP_AbstractAuth {
17 * The realm will be displayed in the dialog boxes
19 * This identifier can be changed through setRealm()
23 protected $realm = 'SabreDAV';
26 * HTTP response helper
28 * @var Sabre_HTTP_Response
30 protected $httpResponse;
36 * @var Sabre_HTTP_Request
38 protected $httpRequest;
44 public function __construct() {
46 $this->httpResponse = new Sabre_HTTP_Response();
47 $this->httpRequest = new Sabre_HTTP_Request();
52 * Sets an alternative HTTP response object
54 * @param Sabre_HTTP_Response $response
57 public function setHTTPResponse(Sabre_HTTP_Response $response) {
59 $this->httpResponse = $response;
64 * Sets an alternative HTTP request object
66 * @param Sabre_HTTP_Request $request
69 public function setHTTPRequest(Sabre_HTTP_Request $request) {
71 $this->httpRequest = $request;
79 * The realm is often displayed in authentication dialog boxes
80 * Commonly an application name displayed here
82 * @param string $realm
85 public function setRealm($realm) {
87 $this->realm = $realm;
96 public function getRealm() {
103 * Returns an HTTP 401 header, forcing login
105 * This should be called when username and password are incorrect, or not supplied at all
109 abstract public function requireLogin();