mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
do more logging during authentication
This commit is contained in:
parent
196fa91a27
commit
31e47d4fbe
|
@ -2639,6 +2639,7 @@ class Auth { /* {{{ */
|
|||
$logger = $this->container->logger;
|
||||
$logger->log("Access with method ".$request->getMethod()." on '".$request->getUri()->getPath()."'".(isset($this->container->environment['HTTP_ORIGIN']) ? " with origin ".$this->container->environment['HTTP_ORIGIN'] : ''), PEAR_LOG_INFO);
|
||||
if($settings->_apiOrigin && isset($this->container->environment['HTTP_ORIGIN'])) {
|
||||
$logger->log("Checking origin", PEAR_LOG_DEBUG);
|
||||
$origins = explode(',', $settings->_apiOrigin);
|
||||
if(!in_array($this->container->environment['HTTP_ORIGIN'], $origins)) {
|
||||
return $response->withStatus(403);
|
||||
|
@ -2648,9 +2649,11 @@ class Auth { /* {{{ */
|
|||
* don't even try to authorize.
|
||||
*/
|
||||
if($request->getMethod() == 'OPTIONS') {
|
||||
$logger->log("Received preflight options request", PEAR_LOG_DEBUG);
|
||||
} elseif(!in_array($request->getUri()->getPath(), array('login')) && substr($request->getUri()->getPath(), 0, 5) != 'echo/') {
|
||||
$userobj = null;
|
||||
if(!empty($this->container->environment['HTTP_AUTHORIZATION']) && !empty($settings->_apiKey) && !empty($settings->_apiUserId)) {
|
||||
$logger->log("Authorization key: ".$this->container->environment['HTTP_AUTHORIZATION'], PEAR_LOG_DEBUG);
|
||||
if($settings->_apiKey == $this->container->environment['HTTP_AUTHORIZATION']) {
|
||||
if(!($userobj = $dms->getUser($settings->_apiUserId))) {
|
||||
return $response->withStatus(403);
|
||||
|
|
Loading…
Reference in New Issue
Block a user