summaryrefslogtreecommitdiffstats
path: root/apps/federation/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/federation/lib')
-rw-r--r--apps/federation/lib/dbhandler.php19
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);
+ }
+
}