summaryrefslogtreecommitdiffstats
path: root/lib/private/Authentication
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2017-01-02 11:57:05 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2017-01-11 19:20:11 +0100
commit21d3fe588396ebb3535a947ee4afd514aa24bd78 (patch)
tree7e1d61534c7e58ef00f607980e0b707afd284ad4 /lib/private/Authentication
parent6f74ecd94a65485f9cd09434845f3c62e66fb9e5 (diff)
downloadnextcloud-server-21d3fe588396ebb3535a947ee4afd514aa24bd78.tar.gz
nextcloud-server-21d3fe588396ebb3535a947ee4afd514aa24bd78.zip
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 <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Authentication')
-rw-r--r--lib/private/Authentication/LoginCredentials/Store.php16
1 files changed, 10 insertions, 6 deletions
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();