diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-03 16:22:18 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-12 14:24:01 +0100 |
commit | cdc536c42367a1c7667a63c598f50b95956da759 (patch) | |
tree | 2805f98880091afccffcea07ebbe5dda643a0425 /apps/federation/lib | |
parent | 4fc0fbe8d04b7b89ffe1c3b79621ebe12b2057be (diff) | |
download | nextcloud-server-cdc536c42367a1c7667a63c598f50b95956da759.tar.gz nextcloud-server-cdc536c42367a1c7667a63c598f50b95956da759.zip |
Allow trusted servers to authenticate
Diffstat (limited to 'apps/federation/lib')
-rw-r--r-- | apps/federation/lib/dbhandler.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/apps/federation/lib/dbhandler.php b/apps/federation/lib/dbhandler.php index 7606593f780..f86a8e15d80 100644 --- a/apps/federation/lib/dbhandler.php +++ b/apps/federation/lib/dbhandler.php @@ -111,7 +111,7 @@ class DbHandler { */ public function getAllServer() { $query = $this->connection->getQueryBuilder(); - $query->select(['url', 'id', 'status'])->from($this->dbTable); + $query->select(['url', 'id', 'status', 'shared_secret', 'sync_token'])->from($this->dbTable); $result = $query->execute()->fetchAll(); return $result; } @@ -267,4 +267,21 @@ class DbHandler { return $normalized; } + /** + * @param $username + * @param $password + * @return bool + */ + public function auth($username, $password) { + if ($username !== 'system') { + return false; + } + $query = $this->connection->getQueryBuilder(); + $query->select('url')->from($this->dbTable) + ->where($query->expr()->eq('shared_secret', $query->createNamedParameter($password))); + + $result = $query->execute()->fetch(); + return !empty($result); + } + } |