Skip to content

Commit

Permalink
Merge pull request #5 from maykinmedia/fix/4-compatibility-new-brokers
Browse files Browse the repository at this point in the history
Compatibility new OneWelcome and Signicat brokers
  • Loading branch information
alextreme authored Apr 13, 2022
2 parents 99b77d7 + 0273b69 commit dc7f43b
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,21 @@ To generate the dienstcatalogus:
--makelaar_id 00000003332223330000 \
--organization_name "Test Organisation"
Specific broker settings
========================

From 1st of April 2022 certain eHerkenning brokers like OneWelcome and Signicat, require that the artifact resolution
request has the content-type header ``text/xml`` instead of ``application/soap+xml``. This can be configured by including
the following parameter in the ``EHERKENNING`` django setting:

.. code-block:: python
EHERKENNING = {
...
"artifact_resolve_content_type": "text/xml",
...
}
Background information
======================

Expand Down
4 changes: 4 additions & 0 deletions digid_eherkenning/saml2/eherkenning.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ def create_config_dict(self, conf):
},
}
)

config_dict["idp"]["resolveArtifactBindingContentType"] = conf.get(
"artifact_resolve_content_type", "application/soap+xml"
)
return config_dict

def create_config(self, config_dict):
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ django-choices>=1.6.0
defusedxml>=0.5.0
lxml>=4.4.0
# The branch where our changes are maintained is 'maykin'
-e git+https://github.com/maykinmedia/python3-saml.git@a79c79a14ddfc5e6096036a2869d0ad2fcb70749#egg=python3_saml
-e git+https://github.com/maykinmedia/python3-saml.git@f587f77b78be79d51139f29a957b406072e2b537#egg=python3_saml
pyopenssl>=19.1.0
furl==2.1.3
30 changes: 30 additions & 0 deletions tests/test_saml2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,33 @@ def test_signature_digest_algorithm_settings_changed(self):
"http://www.w3.org/2001/04/xmlenc#sha256",
config_dict["security"]["digestAlgorithm"],
)

def test_artifact_resolve_content_type_settings_default(self):
conf = settings.EHERKENNING.copy()
conf.setdefault("acs_path", reverse("eherkenning:acs"))

eherkenning_client = eHerkenningClient()
config_dict = eherkenning_client.create_config_dict(conf)

self.assertIn("resolveArtifactBindingContentType", config_dict["idp"])
self.assertIn(
"application/soap+xml",
config_dict["idp"]["resolveArtifactBindingContentType"],
)

def test_artifact_resolve_content_type_settings(self):
conf = settings.EHERKENNING.copy()
conf.setdefault("acs_path", reverse("eherkenning:acs"))
conf.update(
{
"artifact_resolve_content_type": "text/xml",
}
)

eherkenning_client = eHerkenningClient()
config_dict = eherkenning_client.create_config_dict(conf)

self.assertIn("resolveArtifactBindingContentType", config_dict["idp"])
self.assertIn(
"text/xml", config_dict["idp"]["resolveArtifactBindingContentType"]
)

0 comments on commit dc7f43b

Please sign in to comment.