python3: ascii-encode saml provider id before hashing it (#31183)

This commit is contained in:
Paul Marillonnet 2019-02-21 16:27:13 +01:00
parent 4c9a4359aa
commit 2af185ea6a
1 changed files with 2 additions and 1 deletions

View File

@ -335,7 +335,8 @@ class LibertyProvider(Service):
def save(self, *args, **kwargs):
'''Update the SHA1 hash of the entity_id when saving'''
if self.protocol_conformance == 3:
self.entity_id_sha1 = hashlib.sha1(self.entity_id).hexdigest()
self.entity_id_sha1 = hashlib.sha1(self.entity_id.encode('ascii')) \
.hexdigest()
super(LibertyProvider, self).save(*args, **kwargs)
def clean(self):