mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
refactor: Share code between all mysql based authorizers (#8174)
* Share code between all mysql based authorizers I plan to update the mysql password encryption and this will allow the code to be changed in a single location. It also reduces a lot of duplication. * Fix tests, I suspect reauthenticate will work for these... Do not allow password updates for several authorizers
This commit is contained in:
committed by
Neil Lathwood
parent
f706d0ab41
commit
5141fc4872
@@ -26,10 +26,17 @@
|
||||
namespace LibreNMS\Tests;
|
||||
|
||||
use LibreNMS\Authentication\Auth;
|
||||
use LibreNMS\Exceptions\AuthenticationException;
|
||||
|
||||
// Note that as this test set depends on mres(), it is a DBTestCase even though the database is unused
|
||||
class AuthHTTPTest extends DBTestCase
|
||||
{
|
||||
public function testReauthenticate()
|
||||
{
|
||||
$this->setExpectedException(AuthenticationException::class);
|
||||
Auth::reset()->reauthenticate(null, null);
|
||||
}
|
||||
|
||||
// Document the modules current behaviour, so that changes trigger test failures
|
||||
public function testCapabilityFunctions()
|
||||
{
|
||||
@@ -38,7 +45,6 @@ class AuthHTTPTest extends DBTestCase
|
||||
|
||||
$a = Auth::reset();
|
||||
|
||||
$this->assertFalse($a->reauthenticate(null, null));
|
||||
$this->assertTrue($a->canUpdatePasswords() === 0);
|
||||
$this->assertTrue($a->changePassword(null, null) === 0);
|
||||
$this->assertTrue($a->canManageUsers() === 1);
|
||||
@@ -49,7 +55,7 @@ class AuthHTTPTest extends DBTestCase
|
||||
public function testOldBehaviourAgainstCurrent()
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
||||
$old_username = null;
|
||||
$new_username = null;
|
||||
|
||||
|
Reference in New Issue
Block a user