Changeset 5741


Ignore:
Timestamp:
18/09/09 17:33:39 (10 years ago)
Author:
pjkersha
Message:

Added debug logging of SOAP request for ndg.security.common.soap.client.UrlLib2SOAPClient

Location:
TI12-security/trunk/python
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/Tests/ndg3beta/test_attributeauthority_saml.py

    r5740 r5741  
    11#!/usr/bin/env python 
     2import logging 
     3logging.basicConfig(level=logging.DEBUG) 
     4import unittest 
    25 
    36from ndg.security.test.unit.attributeauthorityclient.\ 
  • TI12-security/trunk/python/ndg_security_common/ndg/security/common/saml/bindings.py

    r5681 r5741  
    99__contact__ = "Philip.Kershaw@stfc.ac.uk" 
    1010__revision__ = '$Id$' 
     11import logging 
     12log = logging.getLogger(__name__) 
     13 
    1114from M2Crypto.m2urllib2 import HTTPSHandler 
    1215 
     
    139142        # Attach query to SOAP body 
    140143        request.envelope.body.elem.append(attributeQueryElem) 
     144             
    141145        response = self.client.send(request) 
    142146         
  • TI12-security/trunk/python/ndg_security_common/ndg/security/common/soap/client.py

    r5738 r5741  
    1010__contact__ = "Philip.Kershaw@stfc.ac.uk" 
    1111__revision__ = '$Id:$' 
     12import logging 
     13log = logging.getLogger(__name__) 
    1214 
    1315from ndg.security.common.soap import SOAPEnvelopeBase 
     16 
    1417 
    1518class SOAPClientError(Exception): 
     
    200203             
    201204        soapRequestStr = soapRequest.envelope.serialize() 
     205         
     206        if log.level <= logging.DEBUG: 
     207            from ndg.security.common.utils.etree import prettyPrint 
     208            log.debug("SOAP Request:") 
     209            log.debug("_"*80) 
     210            log.debug(prettyPrint(soapRequest.envelope.elem)) 
     211 
    202212        soapResponse = UrlLib2SOAPResponse() 
    203213        response = self.openerDirector.open(soapRequest.url,  
  • TI12-security/trunk/python/ndg_security_test/ndg/security/test/config/attributeauthority/sitea/site-a.ini

    r5738 r5741  
    5858 
    5959# Clock skew for SAML Attribute Queries - allow clockSkew number of seconds 
    60 # tolerance for notBefore and notOnOrAfter parameters. Set here to 3 minutes 
     60# tolerance for query issueInstant parameter. Set here to 3 minutes 
    6161attributeAuthority.clockSkew: 180.0 
    6262 
  • TI12-security/trunk/python/ndg_security_test/ndg/security/test/unit/attributeauthorityclient/test_attributeauthorityclient.py

    r5738 r5741  
    1111__revision__ = '$Id:test_attributeauthorityclient.py 4372 2008-10-29 09:45:39Z pjkersha $' 
    1212import logging 
    13 logging.basicConfig() 
     13logging.basicConfig(level=logging.DEBUG) 
    1414 
    1515import unittest 
     
    398398        binding = SamlSoapBinding() 
    399399        response = binding.attributeQuery(attributeQuery, _cfg['uri']) 
    400          
    401         self.assert_( 
    402             response.status.statusCode.value==StatusCode.REQUEST_DENIED_URI) 
     400 
    403401        samlResponseElem = ResponseElementTree.toXML(response) 
    404402         
     
    407405        print("Pretty print SAML Response ...") 
    408406        print(prettyPrint(samlResponseElem)) 
     407         
     408        self.assert_( 
     409            response.status.statusCode.value==StatusCode.REQUEST_DENIED_URI) 
    409410                     
    410411    def test03SAMLAttributeQueryUnknownSubject(self): 
     
    436437        response = binding.attributeQuery(attributeQuery, _cfg['uri']) 
    437438         
    438         self.assert_( 
    439             response.status.statusCode.value==StatusCode.UNKNOWN_PRINCIPAL_URI) 
    440439        samlResponseElem = ResponseElementTree.toXML(response) 
    441          
    442440        print("SAML Response ...") 
    443441        print(ElementTree.tostring(samlResponseElem)) 
    444442        print("Pretty print SAML Response ...") 
    445443        print(prettyPrint(samlResponseElem)) 
     444         
     445        self.assert_( 
     446            response.status.statusCode.value==StatusCode.UNKNOWN_PRINCIPAL_URI) 
    446447              
    447448    def test04SAMLAttributeQueryInvalidAttrName(self): 
     
    473474        response = binding.attributeQuery(attributeQuery, _cfg['uri']) 
    474475         
    475         self.assert_(response.status.statusCode.value==\ 
    476                      StatusCode.INVALID_ATTR_NAME_VALUE_URI) 
    477476        samlResponseElem = ResponseElementTree.toXML(response) 
    478477         
     
    482481        print(prettyPrint(samlResponseElem)) 
    483482         
     483        self.assert_(response.status.statusCode.value==\ 
     484                     StatusCode.INVALID_ATTR_NAME_VALUE_URI) 
     485         
    484486                                                         
    485487if __name__ == "__main__": 
Note: See TracChangeset for help on using the changeset viewer.