summaryrefslogtreecommitdiff
path: root/src/saml2/mongo_store.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/saml2/mongo_store.py')
-rw-r--r--src/saml2/mongo_store.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/saml2/mongo_store.py b/src/saml2/mongo_store.py
index 4120e9e0..903dd481 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
@@ -211,6 +212,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):