From 2af185ea6a633bcdae1d179e4a8983b95ed1e0fd Mon Sep 17 00:00:00 2001 From: Paul Marillonnet Date: Thu, 21 Feb 2019 16:27:13 +0100 Subject: [PATCH] python3: ascii-encode saml provider id before hashing it (#31183) --- src/authentic2/saml/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/authentic2/saml/models.py b/src/authentic2/saml/models.py index dbd80a368..43d5e9f8d 100644 --- a/src/authentic2/saml/models.py +++ b/src/authentic2/saml/models.py @@ -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):