]> git.mxchange.org Git - friendica.git/blobdiff - src/Security/BasicAuth.php
Update copyright
[friendica.git] / src / Security / BasicAuth.php
index 52657057e9078bedd34af0a2e5d75a700b18fa8d..fc31d34b0717507f3dce391bef656b2785ed8b0a 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
  *
@@ -78,9 +78,9 @@ class BasicAuth
                        return [];
                }
 
-               if (!empty(self::$current_token)) {
-                       return self::$current_token;
-               }
+               //if (!empty(self::$current_token)) {
+               //      return self::$current_token;
+               //}
 
                $source = $_REQUEST['source'] ?? '';
 
@@ -177,7 +177,10 @@ class BasicAuth
                                return 0;
                        }
                        Logger::debug('Access denied', ['parameters' => $_SERVER]);
-                       header('WWW-Authenticate: Basic realm="Friendica"');
+                       // Checking for commandline for the tests, we have to avoid to send a header
+                       if (php_sapi_name() !== 'cli') {
+                               header('WWW-Authenticate: Basic realm="Friendica"');
+                       }
                        throw new UnauthorizedException("This API requires login");
                }