Changeset View
Changeset View
Standalone View
Standalone View
lib/ext/Syncroton/Server.php
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | public function handle() | ||||
$this->_logger->debug(__METHOD__ . '::' . __LINE__ . ' REQUEST METHOD: ' . $this->_request->getMethod()); | $this->_logger->debug(__METHOD__ . '::' . __LINE__ . ' REQUEST METHOD: ' . $this->_request->getMethod()); | ||||
switch($this->_request->getMethod()) { | switch($this->_request->getMethod()) { | ||||
case 'OPTIONS': | case 'OPTIONS': | ||||
$this->_handleOptions(); | $this->_handleOptions(); | ||||
break; | break; | ||||
case 'POST': | case 'POST': | ||||
// All requests except OPTIONS must be authenticated | |||||
if (empty($this->_userId)) { | |||||
header('WWW-Authenticate: Basic realm="' . $this->app_name .'"'); | |||||
header('HTTP/1.1 401 Unauthorized'); | |||||
exit; | |||||
} | |||||
$this->_handlePost(); | $this->_handlePost(); | ||||
break; | break; | ||||
case 'GET': | case 'GET': | ||||
vanmeeuwen: So, this request must also be authenticated. | |||||
echo "It works!<br>Your userid is: {$this->_userId} and your IP address is: {$_SERVER['REMOTE_ADDR']}."; | echo "It works!<br>Your userid is: {$this->_userId} and your IP address is: {$_SERVER['REMOTE_ADDR']}."; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* handle options request | * handle options request | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 380 Lines • Show Last 20 Lines |
So, this request must also be authenticated.