Changeset 5359


Ignore:
Timestamp:
05/06/09 13:15:11 (10 years ago)
Author:
pjkersha
Message:
  • ndg.security.test.unit.wssecurity.foursuite: WS-Security signature handler - added a unit test case for a client not setting a timestamp in the input message and the server configured to catch it and raise an exception (using timestampMustBeSet config param)
Location:
TI12-security/trunk/python
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.common/ndg/security/common/wssecurity/__init__.py

    r5357 r5359  
    2727    classes in this module""" 
    2828    def __init__(self, errorMessage): 
    29         log.warning(errorMessage) 
     29        log.error(errorMessage) 
    3030        super(WSSecurityError, self).__init__(errorMessage) 
    3131         
  • TI12-security/trunk/python/ndg.security.common/ndg/security/common/wssecurity/signaturehandler/dom.py

    r5357 r5359  
    528528        try: 
    529529            signatureNodes = signatureNodes[0] 
    530         except: 
     530        except IndexError: 
    531531            # Message wasn't signed 
    532532            msg = "Input message wasn't signed!" 
  • TI12-security/trunk/python/ndg.security.common/ndg/security/common/wssecurity/signaturehandler/foursuite.py

    r5357 r5359  
    473473        try: 
    474474            signatureElem = signatureElem[0] 
    475         except TypeError: 
     475        except IndexError: 
    476476            # Message wasn't signed 
    477477            msg = "Input message wasn't signed!" 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/unit/wssecurity/dom/client/test_echoclient.py

    r5358 r5359  
    7373 
    7474    def test01Echo(self): 
    75         '''test1Echo: test signed message and signed response from server''' 
    7675             
    7776        try: 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/unit/wssecurity/foursuite/client/test_echoclient.py

    r5290 r5359  
    2828 
    2929from ndg.security.test.unit import BaseTestCase 
    30 from ndg.security.common.wssecurity.signaturehandler.foursuite import SignatureHandler 
     30from ndg.security.common.wssecurity.signaturehandler.foursuite import \ 
     31    SignatureHandler 
     32from ndg.security.common.wssecurity.signaturehandler import NoSignatureFound 
    3133from ndg.security.common.wssecurity.utils import DomletteReader, \ 
    3234    DomletteElementProxy 
     
    8082         
    8183 
    82     def test1Echo(self): 
    83         '''test1Echo: test signed message and signed response from server''' 
     84    def test01Echo(self): 
    8485             
    8586        try: 
     
    8889        except: 
    8990            self.fail(traceback.print_exc()) 
    90       
    91 #_____________________________________________________________________________        
    92 class EchoClientTestSuite(unittest.TestSuite): 
    93     def __init__(self): 
    94         map = map(EchoClientTestCase, 
    95                   ( 
    96                     "test1Echo", 
    97                   )) 
    98         unittest.TestSuite.__init__(self, map) 
    99                                          
     91 
     92 
     93    def test02ServerRaiseMissingTimestampError(self): 
     94        # Get server to catch that no timestamp was provided 
     95         
     96        self.clnt.binding.sig_handler.addTimestamp = False 
     97        try: 
     98            resp = self.clnt.Echo("Hello again from client") 
     99             
     100        except NoSignatureFound: 
     101            print "PASSED - server rejected client message with no timestamp" 
     102        else: 
     103            self.fail("Expecting error from server because client didn't set " 
     104                      "a timestamp element") 
     105 
    100106if __name__ == "__main__": 
    101107    unittest.main() 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/unit/wssecurity/foursuite/server/wssecurity.cfg

    r5057 r5359  
    9696# - NB, the two CA certificates are for the python and the java clients, respectively 
    9797caCertFilePathList=$NDGSEC_TEST_CONFIG_DIR/ca/java-ca.crt $NDGSEC_TEST_CONFIG_DIR/ca/ndg-test-ca.crt 
     98 
     99# Force an exception if a client message doesn't contain a timestamp 
     100timestampMustBeSet=True 
Note: See TracChangeset for help on using the changeset viewer.