]> git.mxchange.org Git - friendica.git/blobdiff - src/Security/OAuth.php
Contact suggestions are now cached
[friendica.git] / src / Security / OAuth.php
index 7210df8c2ede2e687668a5dd4829a8954fa81b1a..3eaa022c502152361e822eb59f2f8121fc00d8cc 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -83,6 +83,11 @@ class OAuth
        {
                $authorization = $_SERVER['HTTP_AUTHORIZATION'] ?? '';
 
+               if (empty($authorization)) {
+                       // workaround for HTTP-auth in CGI mode
+                       $authorization = $_SERVER['REDIRECT_REMOTE_USER'] ?? '';
+               }
+
                if (substr($authorization, 0, 7) != 'Bearer ') {
                        return [];
                }
@@ -91,7 +96,7 @@ class OAuth
 
                $token = DBA::selectFirst('application-view', ['uid', 'id', 'name', 'website', 'created_at', 'read', 'write', 'follow', 'push'], $condition);
                if (!DBA::isResult($token)) {
-                       Logger::warning('Token not found', $condition);
+                       Logger::notice('Token not found', $condition);
                        return [];
                }
                Logger::debug('Token found', $token);
@@ -171,7 +176,7 @@ class OAuth
                        'write'          => (stripos($scope, BaseApi::SCOPE_WRITE) !== false),
                        'follow'         => (stripos($scope, BaseApi::SCOPE_FOLLOW) !== false),
                        'push'           => (stripos($scope, BaseApi::SCOPE_PUSH) !== false),
-                       'created_at'     => DateTimeFormat::utcNow(DateTimeFormat::MYSQL)];
+                       'created_at'     => DateTimeFormat::utcNow()];
 
                foreach ([BaseApi::SCOPE_READ, BaseApi::SCOPE_WRITE, BaseApi::SCOPE_WRITE, BaseApi::SCOPE_PUSH] as $scope) {
                        if ($fields[$scope] && !$application[$scope]) {