Skip to content

Commit 303efd9

Browse files
author
Ioannis Kakavas
committed
Updated tests to work with new default signing requirements
Explicitly allow unsigned responses in tests where we do not sign them.
1 parent f58330e commit 303efd9

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

tests/test_51_client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ def test_response_1(self):
389389
destination="http://lingon.catalogix.se:8087/",
390390
sp_entity_id="urn:mace:example.com:saml:roland:sp",
391391
name_id_policy=nameid_policy,
392+
sign_response=True,
392393
393394
authn=AUTHN)
394395

@@ -433,6 +434,7 @@ def test_response_1(self):
433434
in_response_to="id2",
434435
destination="http://lingon.catalogix.se:8087/",
435436
sp_entity_id="urn:mace:example.com:saml:roland:sp",
437+
sign_response=True,
436438
name_id_policy=nameid_policy,
437439
438440
authn=AUTHN)
@@ -889,7 +891,6 @@ def test_sign_then_encrypt_assertion2(self):
889891
node_id=assertion.id)
890892

891893
sigass = rm_xmltag(sigass)
892-
893894
response = sigver.response_factory(
894895
in_response_to="_012345",
895896
destination="http://lingon.catalogix.se:8087/",
@@ -912,6 +913,8 @@ def test_sign_then_encrypt_assertion2(self):
912913

913914
resp_str = base64.encodestring(enctext.encode('utf-8'))
914915
# Now over to the client side
916+
# Explicitely allow unsigned responses for this and the following 2 tests
917+
self.client.want_response_signed = False
915918
resp = self.client.parse_authn_request_response(
916919
resp_str, BINDING_HTTP_POST,
917920
{"_012345": "http://foo.example.com/service"})
@@ -1313,6 +1316,9 @@ def test_sign_then_encrypt_assertion_advice_2(self):
13131316

13141317
def test_signed_redirect(self):
13151318

1319+
# Revert configuration change to disallow unsinged responses
1320+
self.client.want_response_signed = True
1321+
13161322
msg_str = "%s" % self.client.create_authn_request(
13171323
"http://localhost:8088/sso", message_id="id1")[1]
13181324

@@ -1544,6 +1550,8 @@ def test_post_sso(self):
15441550
response = self.client.send(**http_args)
15451551
print(response.text)
15461552
_dic = unpack_form(response.text[3], "SAMLResponse")
1553+
# Explicitly allow unsigned responses for this test
1554+
self.client.want_response_signed = False
15471555
resp = self.client.parse_authn_request_response(_dic["SAMLResponse"],
15481556
BINDING_HTTP_POST,
15491557
{sid: "/"})

tests/test_60_sp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
class TestSP():
4747
def setup_class(self):
4848
self.sp = make_plugin("rem", saml_conf="server_conf")
49+
# Explicitly allow unsigned responses for this test
50+
self.sp.saml_client.want_response_signed = False
4951
self.server = Server(config_file="idp_conf")
5052

5153
def teardown_class(self):

tests/test_63_ecp.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_complete_flow():
9292
entity_id=sp_entity_id)
9393

9494
resp = idp.create_ecp_authn_request_response(
95-
destination, {"eduPersonEntitlement": "Short stop",
95+
destination,{"eduPersonEntitlement": "Short stop",
9696
"surName": "Jeter",
9797
"givenName": "Derek",
9898
"mail": "[email protected]",
@@ -136,7 +136,8 @@ def test_complete_flow():
136136
assert inst.text == "XYZ"
137137

138138
# parse the response
139-
139+
# Explicitly allow unsigned responses for this test
140+
sp.want_response_signed = False
140141
resp = sp.parse_authn_request_response(respdict["body"], None, {sid: "/"})
141142

142143
print(resp.response)

tests/test_65_authn_query.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ def test_flow():
9292
# ------- @SP ----------
9393

9494
xmlstr = get_msg(hinfo, binding)
95+
# Explicitly allow unsigned responses for this test
96+
sp.want_response_signed = False
9597
aresp = sp.parse_authn_request_response(xmlstr, binding,
9698
{resp.in_response_to: "/"})
9799

tests/test_68_assertion_id.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def test_basic_flow():
7878
# --------- @SP -------------
7979

8080
xmlstr = get_msg(hinfo, binding)
81-
81+
# Explicitly allow unsigned responses for this test
82+
sp.want_response_signed = False
8283
aresp = sp.parse_authn_request_response(xmlstr, binding,
8384
{resp.in_response_to: "/"})
8485

0 commit comments

Comments
 (0)