Skip to content

Commit d544328

Browse files
committed
Add eIDAS IdP validation rule for WantAuthnRequestsSigned
- Adds error validation rule to require want_authn_requests_signed to be set to True as defined in the eIDAS SAML Message Format v.1.2 spec document - Adds tests for the above scenario
1 parent a029ce8 commit d544328

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/saml2/config.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,10 @@ def warning_validators(self):
737737

738738
@property
739739
def error_validators(self):
740-
idp_error_validators = {}
740+
idp_error_validators = {
741+
"want_authn_requests_signed MUST be set to True":
742+
getattr(self, "_idp_want_authn_requests_signed", None) is True
743+
}
741744
return {**super().error_validators, **idp_error_validators}
742745

743746

tests/eidas/eidas_idp_conf.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"subject_data": full_path("subject_data.db"),
3838
"node_country": "GR",
3939
"application_identifier": "CEF:eIDAS-ref:2.0",
40-
"protocol_version": [1.1, 2.2]
40+
"protocol_version": [1.1, 2.2],
41+
"want_authn_requests_signed": True
4142
},
4243
},
4344
"debug": 1,

tests/eidas/test_idp.py

+10
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,13 @@ def test_entityid_no_https(self, config):
240240
config["entityid"] = "urn:mace:example.com:saml:roland:idp"
241241

242242
self.assert_validation_error(config)
243+
244+
def test_want_authn_requests_signed_unset(self, config):
245+
del config["service"]["idp"]["want_authn_requests_signed"]
246+
247+
self.assert_validation_error(config)
248+
249+
def test_want_authn_requests_signed_false(self, config):
250+
config["service"]["idp"]["want_authn_requests_signed"] = False
251+
252+
self.assert_validation_error(config)

0 commit comments

Comments
 (0)