diff --git a/passbook/providers/saml/forms.py b/passbook/providers/saml/forms.py index 01f44e519..a5b4d17c7 100644 --- a/passbook/providers/saml/forms.py +++ b/passbook/providers/saml/forms.py @@ -59,7 +59,7 @@ class SAMLProviderForm(forms.ModelForm): class SAMLPropertyMappingForm(forms.ModelForm): """SAML Property Mapping form""" - template_name = "saml/idp/property_mapping_form.html" + template_name = "providers/saml/property_mapping_form.html" def clean_expression(self): """Test Syntax""" diff --git a/passbook/providers/saml/processors/base.py b/passbook/providers/saml/processors/base.py index 966f687de..d80201510 100644 --- a/passbook/providers/saml/processors/base.py +++ b/passbook/providers/saml/processors/base.py @@ -132,7 +132,7 @@ class Processor: continue self._assertion_params["ATTRIBUTES"] = attributes self._assertion_xml = get_assertion_xml( - "saml/xml/assertions/generic.xml", self._assertion_params, signed=True + "providers/saml/xml/assertions/generic.xml", self._assertion_params, signed=True ) def _format_response(self): diff --git a/passbook/providers/saml/processors/salesforce.py b/passbook/providers/saml/processors/salesforce.py index b2d3a369a..2c43ca10d 100644 --- a/passbook/providers/saml/processors/salesforce.py +++ b/passbook/providers/saml/processors/salesforce.py @@ -10,5 +10,5 @@ class SalesForceProcessor(GenericProcessor): def _format_assertion(self): super()._format_assertion() self._assertion_xml = get_assertion_xml( - "saml/xml/assertions/salesforce.xml", self._assertion_params, signed=True + "providers/saml/xml/assertions/salesforce.xml", self._assertion_params, signed=True ) diff --git a/passbook/providers/saml/templates/saml/idp/admin_metadata_modal.html b/passbook/providers/saml/templates/providers/saml/admin_metadata_modal.html similarity index 100% rename from passbook/providers/saml/templates/saml/idp/admin_metadata_modal.html rename to passbook/providers/saml/templates/providers/saml/admin_metadata_modal.html diff --git a/passbook/providers/saml/templates/saml/idp/autosubmit_form.html b/passbook/providers/saml/templates/providers/saml/autosubmit_form.html similarity index 100% rename from passbook/providers/saml/templates/saml/idp/autosubmit_form.html rename to passbook/providers/saml/templates/providers/saml/autosubmit_form.html diff --git a/passbook/providers/saml/templates/saml/idp/logged_out.html b/passbook/providers/saml/templates/providers/saml/logged_out.html similarity index 100% rename from passbook/providers/saml/templates/saml/idp/logged_out.html rename to passbook/providers/saml/templates/providers/saml/logged_out.html diff --git a/passbook/providers/saml/templates/saml/idp/property_mapping_form.html b/passbook/providers/saml/templates/providers/saml/property_mapping_form.html similarity index 100% rename from passbook/providers/saml/templates/saml/idp/property_mapping_form.html rename to passbook/providers/saml/templates/providers/saml/property_mapping_form.html diff --git a/passbook/providers/saml/templates/saml/xml/assertions/generic.xml b/passbook/providers/saml/templates/providers/saml/xml/assertions/generic.xml similarity index 94% rename from passbook/providers/saml/templates/saml/xml/assertions/generic.xml rename to passbook/providers/saml/templates/providers/saml/xml/assertions/generic.xml index 1976b936c..c44402aa6 100644 --- a/passbook/providers/saml/templates/saml/xml/assertions/generic.xml +++ b/passbook/providers/saml/templates/providers/saml/xml/assertions/generic.xml @@ -3,7 +3,7 @@ IssueInstant="{{ ISSUE_INSTANT }}" Version="2.0"> {{ ISSUER }} - {% include 'saml/xml/signature.xml' %} + {% include 'providers/saml/xml/signature.xml' %} {{ SUBJECT_STATEMENT }} diff --git a/passbook/providers/saml/templates/saml/xml/assertions/google_apps.xml b/passbook/providers/saml/templates/providers/saml/xml/assertions/google_apps.xml similarity index 85% rename from passbook/providers/saml/templates/saml/xml/assertions/google_apps.xml rename to passbook/providers/saml/templates/providers/saml/xml/assertions/google_apps.xml index b4d262b45..8072b9ee4 100644 --- a/passbook/providers/saml/templates/saml/xml/assertions/google_apps.xml +++ b/passbook/providers/saml/templates/providers/saml/xml/assertions/google_apps.xml @@ -3,8 +3,8 @@ IssueInstant="{{ ISSUE_INSTANT }}" Version="2.0"> {{ ISSUER }} - {% include 'saml/xml/signature.xml' %} - {% include 'saml/xml/subject.xml' %} + {% include 'providers/saml/xml/signature.xml' %} + {% include 'providers/saml/xml/subject.xml' %} diff --git a/passbook/providers/saml/templates/saml/xml/assertions/salesforce.xml b/passbook/providers/saml/templates/providers/saml/xml/assertions/salesforce.xml similarity index 94% rename from passbook/providers/saml/templates/saml/xml/assertions/salesforce.xml rename to passbook/providers/saml/templates/providers/saml/xml/assertions/salesforce.xml index 7451553a0..8887714f2 100644 --- a/passbook/providers/saml/templates/saml/xml/assertions/salesforce.xml +++ b/passbook/providers/saml/templates/providers/saml/xml/assertions/salesforce.xml @@ -4,7 +4,7 @@ Version="2.0"> {{ ISSUER }} {{ ASSERTION_SIGNATURE|safe }} - {% include 'saml/xml/subject.xml' %} + {% include 'providers/saml/xml/subject.xml' %} {{ AUDIENCE }} diff --git a/passbook/providers/saml/templates/saml/xml/attributes.xml b/passbook/providers/saml/templates/providers/saml/xml/attributes.xml similarity index 100% rename from passbook/providers/saml/templates/saml/xml/attributes.xml rename to passbook/providers/saml/templates/providers/saml/xml/attributes.xml diff --git a/passbook/providers/saml/templates/saml/xml/metadata.xml b/passbook/providers/saml/templates/providers/saml/xml/metadata.xml similarity index 100% rename from passbook/providers/saml/templates/saml/xml/metadata.xml rename to passbook/providers/saml/templates/providers/saml/xml/metadata.xml diff --git a/passbook/providers/saml/templates/saml/xml/response.xml b/passbook/providers/saml/templates/providers/saml/xml/response.xml similarity index 100% rename from passbook/providers/saml/templates/saml/xml/response.xml rename to passbook/providers/saml/templates/providers/saml/xml/response.xml diff --git a/passbook/providers/saml/templates/saml/xml/signature.xml b/passbook/providers/saml/templates/providers/saml/xml/signature.xml similarity index 100% rename from passbook/providers/saml/templates/saml/xml/signature.xml rename to passbook/providers/saml/templates/providers/saml/xml/signature.xml diff --git a/passbook/providers/saml/templates/saml/xml/subject.xml b/passbook/providers/saml/templates/providers/saml/xml/subject.xml similarity index 100% rename from passbook/providers/saml/templates/saml/xml/subject.xml rename to passbook/providers/saml/templates/providers/saml/xml/subject.xml diff --git a/passbook/providers/saml/utils/xml_render.py b/passbook/providers/saml/utils/xml_render.py index d740f9ac8..58f1d37bb 100644 --- a/passbook/providers/saml/utils/xml_render.py +++ b/passbook/providers/saml/utils/xml_render.py @@ -28,7 +28,7 @@ def _get_attribute_statement(params): return # Build complete AttributeStatement. params["ATTRIBUTE_STATEMENT"] = render_to_string( - "saml/xml/attributes.xml", {"attributes": attributes} + "providers/saml/xml/attributes.xml", {"attributes": attributes} ) @@ -48,7 +48,7 @@ def _get_in_response_to(params): def _get_subject(params): """Insert Subject. Modifies the params dict.""" - params["SUBJECT_STATEMENT"] = render_to_string("saml/xml/subject.xml", params) + params["SUBJECT_STATEMENT"] = render_to_string("providers/saml/xml/subject.xml", params) def get_assertion_xml(template, parameters, signed=False): @@ -80,7 +80,7 @@ def get_response_xml(parameters, saml_provider: SAMLProvider, assertion_id=""): params["RESPONSE_SIGNATURE"] = "" _get_in_response_to(params) - raw_response = render_to_string("saml/xml/response.xml", params) + raw_response = render_to_string("providers/saml/xml/response.xml", params) if not saml_provider.signing_kp: return raw_response diff --git a/passbook/providers/saml/utils/xml_signing.py b/passbook/providers/saml/utils/xml_signing.py index 215b29830..ba9c0a1f4 100644 --- a/passbook/providers/saml/utils/xml_signing.py +++ b/passbook/providers/saml/utils/xml_signing.py @@ -35,4 +35,4 @@ def sign_with_signxml(data: str, provider: "SAMLProvider", reference_uri=None) - def get_signature_xml() -> str: """Returns XML Signature for subject.""" - return render_to_string("saml/xml/signature.xml", {}) + return render_to_string("providers/saml/xml/signature.xml", {}) diff --git a/passbook/providers/saml/views.py b/passbook/providers/saml/views.py index 9b2a3fb11..dbba7fa59 100644 --- a/passbook/providers/saml/views.py +++ b/passbook/providers/saml/views.py @@ -205,7 +205,7 @@ class SAMLFlowFinalView(StageView): if provider.sp_binding == SAMLBindings.POST: return render( self.request, - "saml/idp/autosubmit_form.html", + "providers/saml/autosubmit_form.html", { "url": response.acs_url, "application": application, @@ -257,7 +257,7 @@ class DescriptorDownloadView(LoginRequiredMixin, SAMLAccessMixin, View): ctx["cert_public_key"] = strip_pem_header( provider.signing_kp.certificate_data.replace("\r", "") ).replace("\n", "") - return render_to_string("saml/xml/metadata.xml", ctx) + return render_to_string("providers/saml/xml/metadata.xml", ctx) def get(self, request: HttpRequest, application_slug: str) -> HttpResponse: """Replies with the XML Metadata IDSSODescriptor.""" diff --git a/passbook/root/settings.py b/passbook/root/settings.py index 9698ca73c..739edc462 100644 --- a/passbook/root/settings.py +++ b/passbook/root/settings.py @@ -333,7 +333,6 @@ LOGGING = { TEST = False TEST_RUNNER = "xmlrunner.extra.djangotestrunner.XMLTestRunner" -TEST_OUTPUT_VERBOSE = 2 LOG_LEVEL = CONFIG.y("log_level").upper() TEST_OUTPUT_FILE_NAME = "unittest.xml"