diff sat_pubsub/backend.py @ 460:607616f9ef5b

backend: new `server_jid` option: Server domain must be known to validate requests, this can be done explicitely by using the `server_jid` option. If this option is not set, the server domain is found: - by using the `from` name of the initial delegation advertising message - or it fallbacks to using the part after initial `.` (`pubsub.example.org` would give `example.org`)
author Goffi <goffi@goffi.org>
date Fri, 15 Oct 2021 09:32:07 +0200
parents cebcb7f56889
children c9238fca1fb3
line wrap: on
line diff
--- a/sat_pubsub/backend.py	Fri Oct 15 09:32:04 2021 +0200
+++ b/sat_pubsub/backend.py	Fri Oct 15 09:32:07 2021 +0200
@@ -224,6 +224,11 @@
         self.storage = storage
         self.config = config
         self.admins = config['admins_jids_list']
+        self.jid = config["jid"]
+        if config["server_jid"] is None:
+            self.server_jid = jid.JID(str(self.jid).split(".", 1)[1])
+        else:
+            self.server_jid = jid.JID(config["server_jid"])
         d = self.storage.getFTSLanguages()
         d.addCallbacks(self._getFTSLanguagesCb, self._getFTSLanguagesEb)