From f2119ce567460e8c74be7e5366c8f7d088acbb6a Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 5 Mar 2020 17:09:08 +0100 Subject: [PATCH] providers/saml: fix signing_kp typo --- passbook/providers/saml/api.py | 2 +- passbook/providers/saml/forms.py | 2 +- .../saml/migrations/0008_auto_20200305_1606.py | 16 ++++++++++++++++ passbook/providers/saml/models.py | 2 +- passbook/providers/saml/utils/xml_signing.py | 4 ++-- passbook/providers/saml/views.py | 2 +- 6 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 passbook/providers/saml/migrations/0008_auto_20200305_1606.py diff --git a/passbook/providers/saml/api.py b/passbook/providers/saml/api.py index 1f8d4d6ec..6a5baf748 100644 --- a/passbook/providers/saml/api.py +++ b/passbook/providers/saml/api.py @@ -24,7 +24,7 @@ class SAMLProviderSerializer(ModelSerializer): "property_mappings", "digest_algorithm", "signature_algorithm", - "singing_kp", + "signing_kp", ] diff --git a/passbook/providers/saml/forms.py b/passbook/providers/saml/forms.py index e2178f1f6..1fa0e7adf 100644 --- a/passbook/providers/saml/forms.py +++ b/passbook/providers/saml/forms.py @@ -33,7 +33,7 @@ class SAMLProviderForm(forms.ModelForm): "property_mappings", "digest_algorithm", "signature_algorithm", - "singing_kp", + "signing_kp", ] widgets = { "name": forms.TextInput(), diff --git a/passbook/providers/saml/migrations/0008_auto_20200305_1606.py b/passbook/providers/saml/migrations/0008_auto_20200305_1606.py new file mode 100644 index 000000000..e5b2746d7 --- /dev/null +++ b/passbook/providers/saml/migrations/0008_auto_20200305_1606.py @@ -0,0 +1,16 @@ +# Generated by Django 3.0.3 on 2020-03-05 16:06 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("passbook_providers_saml", "0007_auto_20200303_2157"), + ] + + operations = [ + migrations.RenameField( + model_name="samlprovider", old_name="singing_kp", new_name="signing_kp", + ), + ] diff --git a/passbook/providers/saml/models.py b/passbook/providers/saml/models.py index d215f1a9b..1007b71d2 100644 --- a/passbook/providers/saml/models.py +++ b/passbook/providers/saml/models.py @@ -75,7 +75,7 @@ class SAMLProvider(Provider): default="rsa-sha256", ) - singing_kp = models.ForeignKey( + signing_kp = models.ForeignKey( CertificateKeyPair, default=None, null=True, diff --git a/passbook/providers/saml/utils/xml_signing.py b/passbook/providers/saml/utils/xml_signing.py index 3afa2bdff..9622a76a6 100644 --- a/passbook/providers/saml/utils/xml_signing.py +++ b/passbook/providers/saml/utils/xml_signing.py @@ -33,10 +33,10 @@ def sign_with_signxml(data: str, provider: "SAMLProvider", reference_uri=None) - signed = signer.sign( root, key=key, - cert=[provider.singing_kp.certificate_data], + cert=[provider.signing_kp.certificate_data], reference_uri=reference_uri, ) - XMLVerifier().verify(signed, x509_cert=provider.singing_kp.certificate_data) + XMLVerifier().verify(signed, x509_cert=provider.signing_kp.certificate_data) return etree.tostring(signed).decode("utf-8") # nosec diff --git a/passbook/providers/saml/views.py b/passbook/providers/saml/views.py index 3a3dc0665..49ea5e6d3 100644 --- a/passbook/providers/saml/views.py +++ b/passbook/providers/saml/views.py @@ -275,7 +275,7 @@ class DescriptorDownloadView(AccessRequiredView): ) ) pubkey = strip_pem_header( - provider.singing_kp.certificate_data.replace("\r", "") + provider.signing_kp.certificate_data.replace("\r", "") ).replace("\n", "") subject_format = provider.processor.subject_format ctx = {