summaryrefslogtreecommitdiff
path: root/src/saml2/sdb.py
diff options
context:
space:
mode:
authorClint Byrum <clint@fewbar.com>2015-05-24 07:57:13 -0700
committerClint Byrum <clint@fewbar.com>2015-05-28 09:50:57 -0700
commitc2f95ccfbe1158f3ead8a7109c756ef91f8a7703 (patch)
treecd3ef27aac55f0e64e6fb9e3411fea570109322d /src/saml2/sdb.py
parentb928d8152704446e34340221b31819df1414609a (diff)
downloadpysaml2-c2f95ccfbe1158f3ead8a7109c756ef91f8a7703.tar.gz
Fix assertion test failures in python3
More strings/bytes problems causing issues with hashing. This further cements that all data coming into pysaml2 will need to be utf-8, or the API will need to have more places to specify alternative encodings.
Diffstat (limited to 'src/saml2/sdb.py')
-rw-r--r--src/saml2/sdb.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/saml2/sdb.py b/src/saml2/sdb.py
index f70226ca..d8d21695 100644
--- a/src/saml2/sdb.py
+++ b/src/saml2/sdb.py
@@ -2,7 +2,7 @@ import logging
from hashlib import sha1
-from saml2.ident import code
+from saml2.ident import code_binary
from saml2 import md
from saml2 import saml
@@ -49,7 +49,7 @@ class SessionStorage(object):
def store_assertion(self, assertion, to_sign):
self.assertion[assertion.id] = (assertion, to_sign)
- key = sha1(code(assertion.subject.name_id)).hexdigest()
+ key = sha1(code_binary(assertion.subject.name_id)).hexdigest()
try:
self.authn[key].append(assertion.authn_statement)
except KeyError:
@@ -68,7 +68,7 @@ class SessionStorage(object):
:return:
"""
result = []
- key = sha1(code(name_id)).hexdigest()
+ key = sha1(code_binary(name_id)).hexdigest()
try:
statements = self.authn[key]
except KeyError:
@@ -89,6 +89,6 @@ class SessionStorage(object):
def remove_authn_statements(self, name_id):
logger.debug("remove authn about: %s" % name_id)
- nkey = sha1(code(name_id)).hexdigest()
+ nkey = sha1(code_binary(name_id)).hexdigest()
del self.authn[nkey]