Browse Source

Add support for pysaml2 >= 7.1.0

A constant was renamed in commit 1e59eaa0 [1].

[1] https://github.com/IdentityPython/pysaml2/commit/1e59eaa0

Change-Id: I0489fde7eced9af8a534736960b75a0d2c189933
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
changes/58/823658/1
Stephen Finucane 5 months ago
parent
commit
03238e343a
  1. 12
      keystone/federation/idp.py

12
keystone/federation/idp.py

@ -366,7 +366,11 @@ class SAMLGenerator(object):
"""
canonicalization_method = xmldsig.CanonicalizationMethod()
canonicalization_method.algorithm = xmldsig.ALG_EXC_C14N
# TODO(stephenfin): Drop when we remove support for pysaml < 7.1.0
if hasattr(xmldsig, 'TRANSFORM_C14N'): # >= 7.1.0
canonicalization_method.algorithm = xmldsig.TRANSFORM_C14N
else: # < 7.1.0
canonicalization_method.algorithm = xmldsig.ALG_EXC_C14N
signature_method = xmldsig.SignatureMethod(
algorithm=xmldsig.SIG_RSA_SHA1)
@ -374,7 +378,11 @@ class SAMLGenerator(object):
envelope_transform = xmldsig.Transform(
algorithm=xmldsig.TRANSFORM_ENVELOPED)
c14_transform = xmldsig.Transform(algorithm=xmldsig.ALG_EXC_C14N)
# TODO(stephenfin): Drop when we remove support for pysaml < 7.1.0
if hasattr(xmldsig, 'TRANSFORM_C14N'): # >= 7.1.0
c14_transform = xmldsig.Transform(algorithm=xmldsig.TRANSFORM_C14N)
else: # < 7.1.0
c14_transform = xmldsig.Transform(algorithm=xmldsig.ALG_EXC_C14N)
transforms.transform = [envelope_transform, c14_transform]
digest_method = xmldsig.DigestMethod(algorithm=xmldsig.DIGEST_SHA1)

Loading…
Cancel
Save