2013-06-07 11:44:37 +02:00
|
|
|
<?php
|
2013-06-10 17:03:01 +02:00
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
2013-06-07 11:44:37 +02:00
|
|
|
|
|
|
|
namespace Icinga\Authentication;
|
|
|
|
|
|
|
|
class Backend
|
|
|
|
{
|
2013-06-25 12:24:52 +02:00
|
|
|
/**
|
|
|
|
* @var UserBackend
|
|
|
|
*/
|
2013-06-07 11:44:37 +02:00
|
|
|
protected $userBackend;
|
|
|
|
|
|
|
|
public function __construct($config)
|
|
|
|
{
|
|
|
|
$this->config = $config;
|
|
|
|
$userbackend = ucwords(strtolower($config->users->backend));
|
|
|
|
$class = '\\Icinga\\Authentication\\' . $userbackend . 'UserBackend';
|
|
|
|
$this->userBackend = new $class($config->users);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasUsername($username)
|
|
|
|
{
|
|
|
|
return $this->userBackend->hasUsername($username);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function authenticate($username, $password = null)
|
|
|
|
{
|
|
|
|
return $this->userBackend->authenticate($username, $password);
|
|
|
|
}
|
|
|
|
}
|