mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
@@ -26,6 +26,7 @@
|
||||
namespace LibreNMS\Tests;
|
||||
|
||||
use LibreNMS\Authentication\LegacyAuth;
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Exceptions\AuthenticationException;
|
||||
|
||||
// Note that as this test set depends on mres(), it is a DBTestCase even though the database is unused
|
||||
@@ -34,8 +35,7 @@ class AuthHTTPTest extends DBTestCase
|
||||
// Document the modules current behaviour, so that changes trigger test failures
|
||||
public function testCapabilityFunctions()
|
||||
{
|
||||
global $config;
|
||||
$config['auth_mechanism'] = 'http-auth';
|
||||
Config::set('auth_mechanism', 'http-auth');
|
||||
|
||||
$a = LegacyAuth::reset();
|
||||
|
||||
@@ -48,12 +48,10 @@ class AuthHTTPTest extends DBTestCase
|
||||
|
||||
public function testOldBehaviourAgainstCurrent()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$old_username = null;
|
||||
$new_username = null;
|
||||
|
||||
$config['auth_mechanism'] = 'http-auth';
|
||||
Config::set('auth_mechanism', 'http-auth');
|
||||
$users = array('steve', ' steve', 'steve ', ' steve ', ' steve ', '', 'CAT');
|
||||
$vars = array('REMOTE_USER', 'PHP_AUTH_USER');
|
||||
|
||||
@@ -66,7 +64,7 @@ class AuthHTTPTest extends DBTestCase
|
||||
// Old Behaviour
|
||||
if (isset($_SERVER['REMOTE_USER'])) {
|
||||
$old_username = clean($_SERVER['REMOTE_USER']);
|
||||
} elseif (isset($_SERVER['PHP_AUTH_USER']) && $config['auth_mechanism'] === 'http-auth') {
|
||||
} elseif (isset($_SERVER['PHP_AUTH_USER']) && Config::get('auth_mechanism') === 'http-auth') {
|
||||
$old_username = clean($_SERVER['PHP_AUTH_USER']);
|
||||
}
|
||||
|
||||
@@ -84,6 +82,6 @@ class AuthHTTPTest extends DBTestCase
|
||||
unset($_SERVER[$v]);
|
||||
}
|
||||
|
||||
unset($config['auth_mechanism']);
|
||||
Config::forget('auth_mechanism');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user