mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: ldap-authorization should be considered external (#8047)
* fix: ldap-authorization should be considered external
When sso auth type was added (1c6b7a9
), some code for getting a username
was moved into HttpAuthAuthorizer. LdapAuthorizationAuthorizer uses the
same process to get the username and needs to be updated as well.
* Use common implementation of getExternalUsername
Authorizers get the default implementation by setting AUTH_IS_EXTERNAL.
ADAuthorizationAuthorizer is another candidate.
This commit is contained in:
committed by
Tony Murray
parent
803e5419f3
commit
2fb8dd7904
@@ -8,6 +8,7 @@ use LibreNMS\Exceptions\AuthenticationException;
|
||||
class ADAuthorizationAuthorizer extends AuthorizerBase
|
||||
{
|
||||
protected $ldap_connection;
|
||||
protected static $AUTH_IS_EXTERNAL = 1;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -252,6 +252,10 @@ abstract class AuthorizerBase implements Authorizer
|
||||
|
||||
public function getExternalUsername()
|
||||
{
|
||||
return null;
|
||||
if (isset($_SERVER['REMOTE_USER'])) {
|
||||
return clean($_SERVER['REMOTE_USER']);
|
||||
} elseif (isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
return clean($_SERVER['PHP_AUTH_USER']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -104,13 +104,4 @@ class HttpAuthAuthorizer extends AuthorizerBase
|
||||
{
|
||||
dbUpdate(array('realname' => $realname, 'level' => $level, 'can_modify_passwd' => $can_modify_passwd, 'email' => $email), 'users', '`user_id` = ?', array($user_id));
|
||||
}
|
||||
|
||||
public function getExternalUsername()
|
||||
{
|
||||
if (isset($_SERVER['REMOTE_USER'])) {
|
||||
return clean($_SERVER['REMOTE_USER']);
|
||||
} elseif (isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
return clean($_SERVER['PHP_AUTH_USER']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -45,6 +45,7 @@ use LibreNMS\Exceptions\AuthenticationException;
|
||||
class LdapAuthorizationAuthorizer extends AuthorizerBase
|
||||
{
|
||||
protected $ldap_connection;
|
||||
protected static $AUTH_IS_EXTERNAL = 1;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
Reference in New Issue
Block a user