lib: Add Auth::getRequest()

Basic auth will require the request.

refs #9660
This commit is contained in:
Eric Lippmann 2015-07-29 15:56:45 +02:00
parent 96e3111f58
commit 3ca85f9daa
1 changed files with 21 additions and 0 deletions

View File

@ -5,6 +5,7 @@ namespace Icinga\Authentication;
use Exception; use Exception;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Application\Icinga;
use Icinga\Application\Logger; use Icinga\Application\Logger;
use Icinga\Authentication\UserGroup\UserGroupBackend; use Icinga\Authentication\UserGroup\UserGroupBackend;
use Icinga\Data\ConfigObject; use Icinga\Data\ConfigObject;
@ -24,6 +25,13 @@ class Auth
*/ */
private static $instance; private static $instance;
/**
* Request
*
* @var \Icinga\Web\Request
*/
protected $request;
/** /**
* Authenticated user * Authenticated user
* *
@ -159,6 +167,19 @@ class Auth
return $this->user->getGroups(); return $this->user->getGroups();
} }
/**
* Get the request
*
* @return \Icinga\Web\Request
*/
public function getRequest()
{
if ($this->request === null) {
$this->request = Icinga::app()->getFrontController()->getRequest();
}
return $this->request;
}
/** /**
* Get applied restrictions matching a given restriction name * Get applied restrictions matching a given restriction name
* *