summaryrefslogtreecommitdiff
path: root/postgresqleu/util/versionutil.py
diff options
context:
space:
mode:
authorMagnus Hagander2025-01-07 09:26:43 +0000
committerMagnus Hagander2025-01-07 09:26:43 +0000
commit57ff243916b3a700b2f642393e1dc803fcb706c2 (patch)
treeb23b83e6602cfbd91d18280fc68498ba96ee5fb3 /postgresqleu/util/versionutil.py
parent9aca53b956c646023cedd14556f2c7b2307c3046 (diff)
Support both old and new versions of pyjwt
Pyjwt 2.0 made some incompatible changes in how a signature is verified, so we need to support both the old and the new one. For cleanliness, create a util/versionutil.py that wraps these version specific things. There are clearly more.
Diffstat (limited to 'postgresqleu/util/versionutil.py')
-rw-r--r--postgresqleu/util/versionutil.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/postgresqleu/util/versionutil.py b/postgresqleu/util/versionutil.py
new file mode 100644
index 00000000..24f17e21
--- /dev/null
+++ b/postgresqleu/util/versionutil.py
@@ -0,0 +1,9 @@
+# Generic wrappers to handle backwards incompatible changes in dependencies
+import jwt
+
+
+def decode_unverified_jwt(j):
+ if jwt.__version__ > 2:
+ return jwt.decode(j, options={'verify_signature': False})
+ else:
+ return jwt.decode(j, verify=False)