diff options
Diffstat (limited to 'src/saml2/mongo_store.py')
-rw-r--r-- | src/saml2/mongo_store.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/saml2/mongo_store.py b/src/saml2/mongo_store.py index 6a8f9f45..e064f917 100644 --- a/src/saml2/mongo_store.py +++ b/src/saml2/mongo_store.py @@ -1,3 +1,4 @@ +import datetime from hashlib import sha1 import logging @@ -192,6 +193,9 @@ class MDB(object): else: doc = {} doc.update(kwargs) + # Add timestamp to all documents to allow external garbage collecting + if "created_at" not in doc: + doc["created_at"] = datetime.datetime.utcnow() _ = self.db.insert(doc) def get(self, value=None, **kwargs): |