- Timestamp:
- 11/28/2006 05:34:00 PM (2 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/tests/test_tools/simpletest/authentication.php
r1397 r1526 10 10 */ 11 11 require_once(dirname(__FILE__) . '/http.php'); 12 12 13 13 /** 14 14 * Represents a single security realm's identity. … … 21 21 protected $_username; 22 22 protected $_password; 23 23 24 24 /** 25 25 * Starts with the initial entry directory. … … 36 36 $this->_password = false; 37 37 } 38 38 39 39 /** 40 40 * Adds another location to the realm. … … 45 45 $this->_root = $this->_getCommonPath($this->_root, $url->getPath()); 46 46 } 47 47 48 48 /** 49 49 * Finds the common starting path. … … 63 63 return implode('/', $first) . '/'; 64 64 } 65 65 66 66 /** 67 67 * Sets the identity to try within this realm. … … 74 74 $this->_password = $password; 75 75 } 76 76 77 77 /** 78 78 * Accessor for current identity. … … 83 83 return $this->_username; 84 84 } 85 85 86 86 /** 87 87 * Accessor for current identity. … … 92 92 return $this->_password; 93 93 } 94 94 95 95 /** 96 96 * Test to see if the URL is within the directory … … 109 109 return false; 110 110 } 111 111 112 112 /** 113 113 * Tests to see if one string is a substring of … … 123 123 } 124 124 } 125 125 126 126 /** 127 127 * Manages security realms. … … 131 131 class SimpleAuthenticator { 132 132 protected $_realms; 133 133 134 134 /** 135 135 * Clears the realms. … … 139 139 $this->restartSession(); 140 140 } 141 141 142 142 /** 143 143 * Starts with no realms set up. … … 147 147 $this->_realms = array(); 148 148 } 149 149 150 150 /** 151 151 * Adds a new realm centered the current URL. … … 167 167 $this->_realms[$url->getHost()][$realm] = new SimpleRealm($type, $url); 168 168 } 169 169 170 170 /** 171 171 * Sets the current identity to be presented … … 182 182 } 183 183 } 184 184 185 185 /** 186 186 * Finds the name of the realm by comparing URLs. … … 200 200 return false; 201 201 } 202 202 203 203 /** 204 204 * Presents the appropriate headers for this location. … … 219 219 $this->addBasicHeaders($request, $username, $password); 220 220 } 221 221 222 222 /** 223 223 * Presents the appropriate headers for this … … 229 229 * @static 230 230 */ 231 function addBasicHeaders($request, $username, $password) {231 static function addBasicHeaders($request, $username, $password) { 232 232 if ($username && $password) { 233 233 $request->addHeaderLine(
