From 21d3fe588396ebb3535a947ee4afd514aa24bd78 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 2 Jan 2017 11:57:05 +0100 Subject: do not hard-require the token provider The provider might need DB access and therefore depenedency resolution fails on the setup page where we cannot inject the db implementation. Signed-off-by: Christoph Wurst --- lib/private/Authentication/LoginCredentials/Store.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib/private/Authentication/LoginCredentials') diff --git a/lib/private/Authentication/LoginCredentials/Store.php b/lib/private/Authentication/LoginCredentials/Store.php index c50b7246f64..e44c88c7aea 100644 --- a/lib/private/Authentication/LoginCredentials/Store.php +++ b/lib/private/Authentication/LoginCredentials/Store.php @@ -40,21 +40,21 @@ class Store implements IStore { /** @var ISession */ private $session; - /** @var IProvider */ - private $tokenProvider; - /** @var ILogger */ private $logger; + /** @var IProvider|null */ + private $tokenProvider; + /** * @param ISession $session - * @param IProvider $tokenProvider * @param ILogger $logger + * @param IProvider $tokenProvider */ - public function __construct(ISession $session, IProvider $tokenProvider, ILogger $logger) { + public function __construct(ISession $session, ILogger $logger, IProvider $tokenProvider = null) { $this->session = $session; - $this->tokenProvider = $tokenProvider; $this->logger = $logger; + $this->tokenProvider = $tokenProvider; Util::connectHook('OC_User', 'post_login', $this, 'authenticate'); } @@ -84,6 +84,10 @@ class Store implements IStore { * @throws CredentialsUnavailableException */ public function getLoginCredentials() { + if (is_null($this->tokenProvider)) { + throw new CredentialsUnavailableException(); + } + $trySession = false; try { $sessionId = $this->session->getId(); -- cgit v1.2.3