summaryrefslogtreecommitdiff
path: root/macaroonbakery/checkers.py
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2017-10-31 10:34:41 +0000
committerColin Watson <cjwatson@debian.org>2017-10-31 10:34:41 +0000
commit79ff2842fa477ee0693ea167c0a74cd7cf080d27 (patch)
treed0eb436672c1a73088fce42f939bdf4cf6f4427b /macaroonbakery/checkers.py
Import py-macaroon-bakery_0.0.3.orig.tar.gz
Diffstat (limited to 'macaroonbakery/checkers.py')
-rw-r--r--macaroonbakery/checkers.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/macaroonbakery/checkers.py b/macaroonbakery/checkers.py
new file mode 100644
index 0000000..8d72eb9
--- /dev/null
+++ b/macaroonbakery/checkers.py
@@ -0,0 +1,23 @@
+# Copyright 2017 Canonical Ltd.
+# Licensed under the LGPLv3, see LICENCE file for details.
+
+import collections
+
+_Caveat = collections.namedtuple('Caveat', 'condition location namespace')
+
+
+class Caveat(_Caveat):
+ '''Represents a condition that must be true for a check to complete
+ successfully.
+
+ If location is provided, the caveat must be discharged by
+ a third party at the given location (a URL string).
+
+ The namespace parameter holds the namespace URI string of the
+ condition - if it is provided, it will be converted to a namespace prefix
+ before adding to the macaroon.
+ '''
+ __slots__ = ()
+
+ def __new__(cls, condition, location=None, namespace=None):
+ return super(Caveat, cls).__new__(cls, condition, location, namespace)