From 996aa367d37a45f98385b0a263597cdd64dcebd8 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 12 Jul 2020 17:22:26 +0200 Subject: [PATCH] core: fix autosubmit_form loading full template --- e2e/test_provider_oidc.py | 1 + e2e/test_source_saml.py | 35 +++++++++++++++++-- .../templates/generic/autosubmit_form.html | 5 +-- passbook/sources/saml/forms.py | 9 +++++ 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/e2e/test_provider_oidc.py b/e2e/test_provider_oidc.py index d143591b4..73b653cbe 100644 --- a/e2e/test_provider_oidc.py +++ b/e2e/test_provider_oidc.py @@ -221,6 +221,7 @@ class TestProviderOIDC(SeleniumTestCase): self.wait.until( ec.presence_of_element_located((By.CSS_SELECTOR, "[type=submit]")) ) + sleep(1) self.driver.find_element(By.CSS_SELECTOR, "[type=submit]").click() self.wait.until( diff --git a/e2e/test_source_saml.py b/e2e/test_source_saml.py index 61fd41967..c2fca68f1 100644 --- a/e2e/test_source_saml.py +++ b/e2e/test_source_saml.py @@ -35,6 +35,35 @@ NKUfJyX8qIG5md1YUeT6GBW9Bm2/1/RiO24JTaYlfLdKK9TYb8sG5B+OLab2DImG aQ== -----END CERTIFICATE-----""" +IDP_KEY = """-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDNQIWjOA1vWHUz +SPM1FIKOE4GdH65VtWlpZ9dghH4CFYN0R7mvJj4KBq86Dxt8vJvLMV16GVh0NGCR +50QH8aMbxonDTqXSoXiMM4DDSQTKBYK7aZwftc7FG35gAfdNUdr8e7VbdaPOShuq +qotDyCQpZYzbt86ABnoaJ5okE3pUFIwxw97LcdYsGZz5Ngma/V1to7aMeEqHyl8r +DRbXZUzw/U8g7yC/g+G7+64liJ4FYqLEETLLSUePKLFgUJHXbF2HgIDjur3nxlEa +ecNQYVUTVCGBFpwkI5n1t3m32avwotpUFhMImjkRETyPKZpvl0+p7mop8mwJmKpa +CVuNSj23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yHB5yiek1p/o +CbqRCta/Dx6Eyo0KlNAyPuFPAshupG4NBx7mT2ASfL+2VBHoi6mHSri+BDX5ryYF +fMYvp7URYoq7w7qivRlvvEg5yoYrK13F2+Gj6xJ4jEN9m0KdM/g3mJGq0HBTIQrp +Sm75WXsflOxuTn08LbgGc4s= +-----END PRIVATE KEY-----""" + class TestSourceSAML(SeleniumTestCase): """test SAML Source flow""" @@ -81,7 +110,7 @@ class TestSourceSAML(SeleniumTestCase): authentication_flow = Flow.objects.get(slug="default-source-authentication") enrollment_flow = Flow.objects.get(slug="default-source-enrollment") keypair = CertificateKeyPair.objects.create( - name="test-idp-cert", certificate_data=IDP_CERT + name="test-idp-cert", certificate_data=IDP_CERT, key_data=IDP_KEY, ) SAMLSource.objects.create( @@ -133,7 +162,7 @@ class TestSourceSAML(SeleniumTestCase): authentication_flow = Flow.objects.get(slug="default-source-authentication") enrollment_flow = Flow.objects.get(slug="default-source-enrollment") keypair = CertificateKeyPair.objects.create( - name="test-idp-cert", certificate_data=IDP_CERT + name="test-idp-cert", certificate_data=IDP_CERT, key_data=IDP_KEY, ) SAMLSource.objects.create( @@ -186,7 +215,7 @@ class TestSourceSAML(SeleniumTestCase): authentication_flow = Flow.objects.get(slug="default-source-authentication") enrollment_flow = Flow.objects.get(slug="default-source-enrollment") keypair = CertificateKeyPair.objects.create( - name="test-idp-cert", certificate_data=IDP_CERT + name="test-idp-cert", certificate_data=IDP_CERT, key_data=IDP_KEY, ) SAMLSource.objects.create( diff --git a/passbook/core/templates/generic/autosubmit_form.html b/passbook/core/templates/generic/autosubmit_form.html index 687e76565..902930d4b 100644 --- a/passbook/core/templates/generic/autosubmit_form.html +++ b/passbook/core/templates/generic/autosubmit_form.html @@ -1,4 +1,4 @@ -{% extends "login/base_full.html" %} +{% extends "login/base.html" %} {% load passbook_utils %} {% load i18n %} @@ -28,7 +28,4 @@ - {% endblock %} diff --git a/passbook/sources/saml/forms.py b/passbook/sources/saml/forms.py index 6fe3c0c83..ae3b4fa6e 100644 --- a/passbook/sources/saml/forms.py +++ b/passbook/sources/saml/forms.py @@ -4,7 +4,9 @@ from django import forms from passbook.admin.forms.source import SOURCE_FORM_FIELDS from passbook.flows.models import Flow, FlowDesignation +from passbook.crypto.models import CertificateKeyPair from passbook.sources.saml.models import SAMLSource +from django.utils.translation import gettext as _ class SAMLSourceForm(forms.ModelForm): @@ -16,6 +18,13 @@ class SAMLSourceForm(forms.ModelForm): enrollment_flow = forms.ModelChoiceField( queryset=Flow.objects.filter(designation=FlowDesignation.ENROLLMENT) ) + signing_kp = forms.ModelChoiceField( + queryset=CertificateKeyPair.objects.filter( + certificate_data__isnull=False, + key_data__isnull=False, + ), + help_text=_("Certificate used to sign Requests.") + ) class Meta: