source: TI12-security/trunk/python/Tests/attCertTest.py @ 2437

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/Tests/attCertTest.py@4692
Revision 2437, 1.9 KB checked in by pjkersha, 13 years ago (diff)

ndg.security.server/ndg/security/server/SessionMgr/server-config.tac:

  • soap_disconnect: added call to SessionMgr?.disconnect, added logic for retrieving ID from cert.

used with WS-Security signature.

  • add code to check for useSignatureHandler config param. If this flag is set, get user ID from

cert in WS-Security header

ndg.security.test/ndg/security/test/SessionMgr/sessionMgrProperties.xml,
ndg.security.server/ndg/security/server/SessionMgr/init.py: added "useSignatureHandler" parameter
to properties file elements.

www/html/sessionMgr.wsdl,
ndg.security.server/ndg/security/server/SessionMgr/SessionMgr_services_server.py,
ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services.py,
ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services_types.py: removed userCert
argument. - This is not needed as cert chain can be passed in by setting #X509PKIPathv1 for
BinarySecurityToken?.

ndg.security.client/ndg/security/client/ndgSessionClient.py: started on updates from alpha version -
--req-autho flag is now --req-attr

ndg.security.test/ndg/security/test/AttCert/attCertTest.cfg,
ndg.security.test/ndg/security/test/AttCert/attCertTest.cfg: added more tests for signature
verification tests.

ndg.security.test/ndg/security/test/SessionMgr/SessionMgrClientTest.py: removed userCert arg from
disconnect call. It's passed in the signature in the WS-Security header.

ndg.security.common/ndg/security/common/XMLSec.py: fixed bug in applyEnvelopedSignature - removed
incorrect strip call from digest calc:

calcSignedInfoDigestValue = sha(signedInfoC14n).digest()#.strip()


ndg.security.common/ndg/security/common/SessionMgr/init.py: Session Manager client code -
remove refs to "userCert" for disconnect and connect calls. It's passed in the WS-Security header
instead.

ndg.security.common/ndg/security/common/wsSecurity.py: comment - query whitespace strip in
extraction of calculated signature value from message "b64EncSignatureValue".

  • Property svn:executable set to *
Line 
1#!/bin/env python
2
3import unittest
4from ndg.security.AttCert import *
5
6
7class attCertTestCase(unittest.TestCase):
8   
9    def setUp(self):
10        self.attCert = AttCert()
11        self.attCert['provenance'] = 'original'
12        self.attCert.setValidityTime(lifeTime=60*60*8.)
13        self.attCert.addRoles(['government', 'acsoe', 'atsr'])
14       
15    def tearDown(self):
16        pass
17
18
19           
20    def testAttCert2Sign(self):
21        certFilePathList = [ "./Junk-cert.pem",
22                             "/usr/local/NDG/conf/certs/cacert.pem"]
23                             
24        signingPriKeyFilePath = "./Junk-key.pem"
25        priKeyPwd = open("./tmp2").read().strip()
26       
27        import pdb
28        pdb.set_trace()
29                   
30        # Digitally sign certificate using Attribute Authority's
31        # certificate and private key
32        self.attCert.sign(certFilePathList=certFilePathList,
33                          signingKeyFilePath=signingPriKeyFilePath,
34                          signingKeyPwd=priKeyPwd)
35       
36        # Check the certificate is valid
37        self.attCert.isValid(raiseExcep=True)
38        print "Signature is valid\n"
39       
40        print "AttCert.asString()...\n"
41        print self.attCert.asString()
42           
43           
44    def testAttCert4NonZero(self):
45       
46        try:
47            if not self.attCert:
48                self.fail("AttCert instance yields 0")
49           
50        except Exception, e:
51            self.fail(str(e))
52       
53
54class attCertTestSuite(unittest.TestSuite):
55    def __init__(self):
56        map = map(attCertTestCase,
57                  (
58                    "test1AttCertAddRoles",
59                    "test2AttCertSign",
60                    "test3AttCertAsString",
61                    "test4AttCertNonZero",
62                  ))
63        unittest.TestSuite.__init__(self, map)
64 
65                                       
66if __name__ == "__main__":
67    unittest.main()
Note: See TracBrowser for help on using the repository browser.