summaryrefslogtreecommitdiff
path: root/tests/test_02_saml.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_02_saml.py')
-rw-r--r--tests/test_02_saml.py50
1 files changed, 34 insertions, 16 deletions
diff --git a/tests/test_02_saml.py b/tests/test_02_saml.py
index 7ff64885..2cdb5064 100644
--- a/tests/test_02_saml.py
+++ b/tests/test_02_saml.py
@@ -867,35 +867,53 @@ class TestSubjectConfirmation:
self.sc.subject_confirmation_data = saml.subject_confirmation_data_from_string(
saml2_data.TEST_SUBJECT_CONFIRMATION_DATA)
new_sc = saml.subject_confirmation_from_string(self.sc.to_string())
- assert new_sc.name_id.sp_provided_id == "sp provided id"
- assert new_sc.method == saml.SCM_BEARER
- assert new_sc.subject_confirmation_data.not_before == \
- "2007-08-31T01:05:02Z"
- assert new_sc.subject_confirmation_data.not_on_or_after == \
- "2007-09-14T01:05:02Z"
- assert new_sc.subject_confirmation_data.recipient == "recipient"
- assert new_sc.subject_confirmation_data.in_response_to == "responseID"
- assert new_sc.subject_confirmation_data.address == "127.0.0.1"
-
- def testUsingTestData(self):
- """Test subject_confirmation_from_string() using test data"""
+ self._assertBearer(new_sc)
+ def testBearerUsingTestData(self):
+ """Test subject_confirmation_from_string() using test data for 'bearer' SubjectConfirmation"""
sc = saml.subject_confirmation_from_string(
saml2_data.TEST_SUBJECT_CONFIRMATION)
+ assert sc.verify()
+ self._assertBearer(sc)
+
+ def _assertBearer(self, sc):
+ """Asserts SubjectConfirmation that has method 'bearer'"""
assert sc.name_id.sp_provided_id == "sp provided id"
assert sc.method == saml.SCM_BEARER
+ assert sc.subject_confirmation_data is not None
assert sc.subject_confirmation_data.not_before == "2007-08-31T01:05:02Z"
assert sc.subject_confirmation_data.not_on_or_after == "2007-09-14T01:05:02Z"
assert sc.subject_confirmation_data.recipient == "recipient"
assert sc.subject_confirmation_data.in_response_to == "responseID"
assert sc.subject_confirmation_data.address == "127.0.0.1"
+ assert sc.subject_confirmation_data.key_info is None
- def testVerify(self):
- """Test SubjectConfirmation verify"""
-
+ def testHolderOfKeyUsingTestData(self):
+ """Test subject_confirmation_from_string() using test data for 'holder-of-key' SubjectConfirmation"""
sc = saml.subject_confirmation_from_string(
- saml2_data.TEST_SUBJECT_CONFIRMATION)
+ saml2_data.TEST_HOLDER_OF_KEY_SUBJECT_CONFIRMATION)
assert sc.verify()
+ assert sc.method == saml.SCM_HOLDER_OF_KEY
+ assert sc.subject_confirmation_data is not None
+ assert sc.subject_confirmation_data.not_on_or_after == "2007-09-14T01:05:02Z"
+ assert sc.subject_confirmation_data.recipient == "recipient"
+ assert sc.subject_confirmation_data.in_response_to == "responseID"
+ key_info = sc.subject_confirmation_data.key_info
+ assert len(key_info) == 1
+ assert len(key_info[0].x509_data) == 1
+ assert key_info[0].x509_data[0].x509_certificate.text.strip() == """
+MIICITCCAYoCAQEwDQYJKoZIhvcNAQELBQAwWDELMAkGA1UEBhMCenoxCzAJBgNV
+BAgMAnp6MQ0wCwYDVQQHDAR6enp6MQ4wDAYDVQQKDAVaenp6ejEOMAwGA1UECwwF
+Wnp6enoxDTALBgNVBAMMBHRlc3QwIBcNMTkwNDEyMTk1MDM0WhgPMzAxODA4MTMx
+OTUwMzRaMFgxCzAJBgNVBAYTAnp6MQswCQYDVQQIDAJ6ejENMAsGA1UEBwwEenp6
+ejEOMAwGA1UECgwFWnp6enoxDjAMBgNVBAsMBVp6enp6MQ0wCwYDVQQDDAR0ZXN0
+MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHcj80WU/XBsd9FlyQmfjPUdfm
+edhCFDd6TEQmZNNqP/UG+VkGa+BXjRIHMfic/WxPTbGhCjv68ci0UDNomUXagFex
+LGNpkwa7+CRVtoc/1xgq+ySE6M4nhcCutScoxNvWNn5eSQ66i3U0sTv91MgsXxqE
+dTaiZg0BIufEc3dueQIDAQABMA0GCSqGSIb3DQEBCwUAA4GBAGUV5B+USHvaRa8k
+gCNJSuNpo6ARlv0ekrk8bbdNRBiEUdCMyoGJFfuM9K0zybX6Vr25wai3nvaog294
+Vx/jWjX2g5SDbjItH6VGy6C9GCGf1A07VxFRCfJn5tA9HuJjPKiE+g/BmrV5N4Ce
+alzFxPHWYkNOzoRU8qI7OqUai1kL""".strip()
class TestSubject: