]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/lib/Sabre/HTTP/AbstractAuth.php
Initial Release of the calendar plugin
[friendica-addons.git] / dav / SabreDAV / lib / Sabre / HTTP / AbstractAuth.php
1 <?php
2
3 /**
4  * HTTP Authentication baseclass
5  *
6  * This class has the common functionality for BasicAuth and DigestAuth
7  *
8  * @package Sabre
9  * @subpackage HTTP
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
13  */
14 abstract class Sabre_HTTP_AbstractAuth {
15
16     /**
17      * The realm will be displayed in the dialog boxes
18      *
19      * This identifier can be changed through setRealm()
20      *
21      * @var string
22      */
23     protected $realm = 'SabreDAV';
24
25     /**
26      * HTTP response helper
27      *
28      * @var Sabre_HTTP_Response
29      */
30     protected $httpResponse;
31
32
33     /**
34      * HTTP request helper
35      *
36      * @var Sabre_HTTP_Request
37      */
38     protected $httpRequest;
39
40     /**
41      * __construct
42      *
43      */
44     public function __construct() {
45
46         $this->httpResponse = new Sabre_HTTP_Response();
47         $this->httpRequest = new Sabre_HTTP_Request();
48
49     }
50
51     /**
52      * Sets an alternative HTTP response object
53      *
54      * @param Sabre_HTTP_Response $response
55      * @return void
56      */
57     public function setHTTPResponse(Sabre_HTTP_Response $response) {
58
59         $this->httpResponse = $response;
60
61     }
62
63     /**
64      * Sets an alternative HTTP request object
65      *
66      * @param Sabre_HTTP_Request $request
67      * @return void
68      */
69     public function setHTTPRequest(Sabre_HTTP_Request $request) {
70
71         $this->httpRequest = $request;
72
73     }
74
75
76     /**
77      * Sets the realm
78      *
79      * The realm is often displayed in authentication dialog boxes
80      * Commonly an application name displayed here
81      *
82      * @param string $realm
83      * @return void
84      */
85     public function setRealm($realm) {
86
87         $this->realm = $realm;
88
89     }
90
91     /**
92      * Returns the realm
93      *
94      * @return string
95      */
96     public function getRealm() {
97
98         return $this->realm;
99
100     }
101
102     /**
103      * Returns an HTTP 401 header, forcing login
104      *
105      * This should be called when username and password are incorrect, or not supplied at all
106      *
107      * @return void
108      */
109     abstract public function requireLogin();
110
111 }