core: fix autosubmit_form loading full template

This commit is contained in:
Jens Langhammer 2020-07-12 17:22:26 +02:00
parent be6f342e58
commit 996aa367d3
4 changed files with 43 additions and 7 deletions

View File

@ -221,6 +221,7 @@ class TestProviderOIDC(SeleniumTestCase):
self.wait.until( self.wait.until(
ec.presence_of_element_located((By.CSS_SELECTOR, "[type=submit]")) ec.presence_of_element_located((By.CSS_SELECTOR, "[type=submit]"))
) )
sleep(1)
self.driver.find_element(By.CSS_SELECTOR, "[type=submit]").click() self.driver.find_element(By.CSS_SELECTOR, "[type=submit]").click()
self.wait.until( self.wait.until(

View File

@ -35,6 +35,35 @@ NKUfJyX8qIG5md1YUeT6GBW9Bm2/1/RiO24JTaYlfLdKK9TYb8sG5B+OLab2DImG
aQ== aQ==
-----END CERTIFICATE-----""" -----END CERTIFICATE-----"""
IDP_KEY = """-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDNQIWjOA1vWHUz
SPM1FIKOE4GdH65VtWlpZ9dghH4CFYN0R7mvJj4KBq86Dxt8vJvLMV16GVh0NGCR
50QH8aMbxonDTqXSoXiMM4DDSQTKBYK7aZwftc7FG35gAfdNUdr8e7VbdaPOShuq
qotDyCQpZYzbt86ABnoaJ5okE3pUFIwxw97LcdYsGZz5Ngma/V1to7aMeEqHyl8r
DRbXZUzw/U8g7yC/g+G7+64liJ4FYqLEETLLSUePKLFgUJHXbF2HgIDjur3nxlEa
ecNQYVUTVCGBFpwkI5n1t3m32avwotpUFhMImjkRETyPKZpvl0+p7mop8mwJmKpa
CVuNSj23AgMBAAECggEABn4I/B20xxXcNzASiVZJvua9DdRHtmxTlkLznBj0x2oY
y1/Nbs3d3oFRn5uEuhBZOTcphsgwdRSHDXZsP3gUObew+d2N/zieUIj8hLDVlvJP
rU/s4U/l53Q0LiNByE9ThvL+zJLPCKJtd5uHZjB5fFm69+Q7gu8xg4xHIub+0pP5
PHanmHCDrbgNN/oqlar4FZ2MXT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SAML(SeleniumTestCase):
"""test SAML Source flow""" """test SAML Source flow"""
@ -81,7 +110,7 @@ class TestSourceSAML(SeleniumTestCase):
authentication_flow = Flow.objects.get(slug="default-source-authentication") authentication_flow = Flow.objects.get(slug="default-source-authentication")
enrollment_flow = Flow.objects.get(slug="default-source-enrollment") enrollment_flow = Flow.objects.get(slug="default-source-enrollment")
keypair = CertificateKeyPair.objects.create( 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( SAMLSource.objects.create(
@ -133,7 +162,7 @@ class TestSourceSAML(SeleniumTestCase):
authentication_flow = Flow.objects.get(slug="default-source-authentication") authentication_flow = Flow.objects.get(slug="default-source-authentication")
enrollment_flow = Flow.objects.get(slug="default-source-enrollment") enrollment_flow = Flow.objects.get(slug="default-source-enrollment")
keypair = CertificateKeyPair.objects.create( 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( SAMLSource.objects.create(
@ -186,7 +215,7 @@ class TestSourceSAML(SeleniumTestCase):
authentication_flow = Flow.objects.get(slug="default-source-authentication") authentication_flow = Flow.objects.get(slug="default-source-authentication")
enrollment_flow = Flow.objects.get(slug="default-source-enrollment") enrollment_flow = Flow.objects.get(slug="default-source-enrollment")
keypair = CertificateKeyPair.objects.create( 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( SAMLSource.objects.create(

View File

@ -1,4 +1,4 @@
{% extends "login/base_full.html" %} {% extends "login/base.html" %}
{% load passbook_utils %} {% load passbook_utils %}
{% load i18n %} {% load i18n %}
@ -28,7 +28,4 @@
</div> </div>
</div> </div>
</form> </form>
<script>
document.querySelector("form").submit();
</script>
{% endblock %} {% endblock %}

View File

@ -4,7 +4,9 @@ from django import forms
from passbook.admin.forms.source import SOURCE_FORM_FIELDS from passbook.admin.forms.source import SOURCE_FORM_FIELDS
from passbook.flows.models import Flow, FlowDesignation from passbook.flows.models import Flow, FlowDesignation
from passbook.crypto.models import CertificateKeyPair
from passbook.sources.saml.models import SAMLSource from passbook.sources.saml.models import SAMLSource
from django.utils.translation import gettext as _
class SAMLSourceForm(forms.ModelForm): class SAMLSourceForm(forms.ModelForm):
@ -16,6 +18,13 @@ class SAMLSourceForm(forms.ModelForm):
enrollment_flow = forms.ModelChoiceField( enrollment_flow = forms.ModelChoiceField(
queryset=Flow.objects.filter(designation=FlowDesignation.ENROLLMENT) 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: class Meta: