def test_authn_decl_in_authn_context():
    authnctxt = AuthnContext(authn_context_decl=ACD)

    acs = authn_context_from_string("%s" % authnctxt)
    if acs.extension_elements:
        cacd = authn_context_decl_from_extension_elements(
            acs.extension_elements)
        if cacd:
            acs.authn_context_decl = cacd

    assert acs.authn_context_decl == ACD
Beispiel #2
0
def test_authn_decl_in_authn_context():
    authnctxt = AuthnContext(authn_context_decl=ACD)

    acs = authn_context_from_string("%s" % authnctxt)
    if acs.extension_elements:
        cacd = authn_context_decl_from_extension_elements(
            acs.extension_elements)
        if cacd:
            acs.authn_context_decl = cacd

    assert acs.authn_context_decl == ACD
Beispiel #3
0
 def testAccessors(self):
     """Test for AuthnContext accessors"""
     self.authn_context.authn_context_class_ref = saml.authn_context_class_ref_from_string(
         saml2_data.TEST_AUTHN_CONTEXT_CLASS_REF
     )
     self.authn_context.authn_context_decl_ref = saml.authn_context_decl_ref_from_string(
         saml2_data.TEST_AUTHN_CONTEXT_DECL_REF
     )
     self.authn_context.authn_context_decl = saml.authn_context_decl_from_string(saml2_data.TEST_AUTHN_CONTEXT_DECL)
     self.authn_context.authenticating_authority.append(
         saml.authenticating_authority_from_string(saml2_data.TEST_AUTHENTICATING_AUTHORITY)
     )
     assert self.authn_context.authn_context_class_ref.text.strip() == "http://www.example.com/authnContextClassRef"
     assert self.authn_context.authn_context_decl_ref.text.strip() == "http://www.example.com/authnContextDeclRef"
     assert self.authn_context.authn_context_decl.text.strip() == "http://www.example.com/authnContextDecl"
     assert (
         self.authn_context.authenticating_authority[0].text.strip()
         == "http://www.example.com/authenticatingAuthority"
     )
     new_authn_context = saml.authn_context_from_string(self.authn_context.to_string())
     assert self.authn_context.to_string() == new_authn_context.to_string()
Beispiel #4
0
 def testUsingTestData(self):
     """Test authn_context_from_string() using test data"""
     authn_context = saml.authn_context_from_string(saml2_data.TEST_AUTHN_CONTEXT)
     assert authn_context.authn_context_class_ref.text.strip() == saml.AUTHN_PASSWORD