summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/leap/soledad/server/auth.py18
-rw-r--r--server/src/leap/soledad/server/session.py3
2 files changed, 7 insertions, 14 deletions
diff --git a/server/src/leap/soledad/server/auth.py b/server/src/leap/soledad/server/auth.py
index bcef2e7c..1f078bff 100644
--- a/server/src/leap/soledad/server/auth.py
+++ b/server/src/leap/soledad/server/auth.py
@@ -67,24 +67,20 @@ class TokenChecker(object):
self._dbs = {}
def _tokens_dbname(self):
- dbname = self.TOKENS_DB_PREFIX + \
- str(int(time.time() / self.TOKENS_DB_EXPIRE))
- return dbname
-
- def _get_db(self, dbname):
- if dbname not in self._dbs:
- self._dbs[dbname] = self._server[dbname]
- return self._dbs[dbname]
-
- def _tokens_db(self):
# the tokens db rotates every 30 days, and the current db name is
# "tokens_NNN", where NNN is the number of seconds since epoch
# divide dby the rotate period in seconds. When rotating, old and
# new tokens db coexist during a certain window of time and valid
# tokens are replicated from the old db to the new one. See:
# https://leap.se/code/issues/6785
+ dbname = self.TOKENS_DB_PREFIX + \
+ str(int(time.time() / self.TOKENS_DB_EXPIRE))
+ return dbname
+
+ def _tokens_db(self):
dbname = self._tokens_dbname()
- db = self._get_db(dbname)
+ with self._server as server:
+ db = server[dbname]
return db
def requestAvatarId(self, credentials):
diff --git a/server/src/leap/soledad/server/session.py b/server/src/leap/soledad/server/session.py
index a56e4e97..a2793bd3 100644
--- a/server/src/leap/soledad/server/session.py
+++ b/server/src/leap/soledad/server/session.py
@@ -104,6 +104,3 @@ class SoledadSession(HTTPAuthSessionWrapper):
# if all checks pass, try to login with credentials
return util.DeferredResource(self._login(credentials))
-
-
-soledadSession = SoledadSession()