From 3ca85f9daa77af8e68267233eb2044d5a02f7a7c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 29 Jul 2015 15:56:45 +0200 Subject: [PATCH] lib: Add Auth::getRequest() Basic auth will require the request. refs #9660 --- library/Icinga/Authentication/Auth.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/library/Icinga/Authentication/Auth.php b/library/Icinga/Authentication/Auth.php index 74eb0ad96..ffdddeb67 100644 --- a/library/Icinga/Authentication/Auth.php +++ b/library/Icinga/Authentication/Auth.php @@ -5,6 +5,7 @@ namespace Icinga\Authentication; use Exception; use Icinga\Application\Config; +use Icinga\Application\Icinga; use Icinga\Application\Logger; use Icinga\Authentication\UserGroup\UserGroupBackend; use Icinga\Data\ConfigObject; @@ -24,6 +25,13 @@ class Auth */ private static $instance; + /** + * Request + * + * @var \Icinga\Web\Request + */ + protected $request; + /** * Authenticated user * @@ -159,6 +167,19 @@ class Auth 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 *