From c1a4ba2fc03da5458a10b9a0daf32dbdcfa21ff3 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Tue, 29 Jun 2010 09:15:02 +0000 Subject: Merge branch 'issue-88' --- bindings/python/tests/profiles_tests.py | 51 +++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 15 deletions(-) (limited to 'bindings/python/tests/profiles_tests.py') diff --git a/bindings/python/tests/profiles_tests.py b/bindings/python/tests/profiles_tests.py index 42cac2f9..c923f87f 100755 --- a/bindings/python/tests/profiles_tests.py +++ b/bindings/python/tests/profiles_tests.py @@ -208,6 +208,42 @@ class LoginTestCase(unittest.TestCase): self.failUnless('do action 2' in extensionsList[0]) self.failUnless('do action 3' in extensionsList[0]) + def test05(self): + '''SAMLv2 Authn request emitted and received using Artifact binding''' + + sp = lasso.Server( + os.path.join(dataDir, 'sp5-saml2/metadata.xml'), + os.path.join(dataDir, 'sp5-saml2/private-key.pem')) + assert sp + sp.addProvider( + lasso.PROVIDER_ROLE_IDP, + os.path.join(dataDir, 'idp5-saml2/metadata.xml')) + sp_login = lasso.Login(sp) + assert sp_login + sp_login.initAuthnRequest(None, lasso.HTTP_METHOD_ARTIFACT_GET) + sp_login.buildAuthnRequestMsg() + sp_login_dump = sp_login.dump() + idp = lasso.Server( + os.path.join(dataDir, 'idp5-saml2/metadata.xml'), + os.path.join(dataDir, 'idp5-saml2/private-key.pem')) + idp.addProvider( + lasso.PROVIDER_ROLE_SP, + os.path.join(dataDir, 'sp5-saml2/metadata.xml')) + idp_login = lasso.Login(idp) + idp_login.initRequest(sp_login.msgUrl.split('?')[1], lasso.HTTP_METHOD_ARTIFACT_GET) + idp_login.buildRequestMsg() + sp_login2 = lasso.Login.newFromDump(sp, sp_login_dump) + assert isinstance(sp_login2, lasso.Login) + assert idp_login.msgBody + sp_login2.processRequestMsg(idp_login.msgBody) + sp_login2.buildResponseMsg() + assert sp_login2.msgBody + try: + idp_login.processResponseMsg(sp_login2.msgBody) + except: + print idp_login.response + raise + assert isinstance(idp_login.request, lasso.Samlp2AuthnRequest) class LogoutTestCase(unittest.TestCase): def test01(self): @@ -294,21 +330,6 @@ class LogoutTestCase(unittest.TestCase): else: self.fail('Logout processResponseMsg should have failed.') - def test05(self): - """IDP logout; testing logout dump & newFromDump().""" - - lassoServer = lasso.Server( - os.path.join(dataDir, 'idp1-la/metadata.xml'), - os.path.join(dataDir, 'idp1-la/private-key-raw.pem'), - None, - os.path.join(dataDir, 'idp1-la/certificate.pem')) - lassoServer.addProvider( - lasso.PROVIDER_ROLE_SP, - os.path.join(dataDir, 'sp1-la/metadata.xml'), - os.path.join(dataDir, 'sp1-la/public-key.pem'), - os.path.join(dataDir, 'sp1-la/certificate.pem')) - - class DefederationTestCase(unittest.TestCase): def test01(self): """IDP initiated defederation; testing processNotificationMsg with non Liberty query.""" -- cgit