Changeset 7259 for TI12-security/trunk


Ignore:
Timestamp:
02/08/10 13:26:32 (9 years ago)
Author:
pjkersha
Message:

Fixes for NDG SAML:

  • SOAPBindingInvalidResponse - incorrect superclass and no Response import
  • added support for 'here' directory to config parser
  • cumulative error checking for validation of query parameters prior to despatch
  • Allow for no subject set in ElementTree parser
Location:
TI12-security/trunk/ndg_saml/ndg/saml
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/ndg_saml/ndg/saml/saml2/binding/soap/__init__.py

    r7143 r7259  
    1212__contact__ = "Philip.Kershaw@stfc.ac.uk" 
    1313__revision__ = "$Id$" 
     14from ndg.saml.saml2.core import Response 
     15 
     16                                  
    1417class SOAPBindingError(Exception): 
    1518    '''Base exception type for client SAML SOAP Binding''' 
     
    1922    '''Raise if the response is invalid''' 
    2023    def __init__(self, *arg, **kw): 
    21         SOAPBindingInvalidResponse.__init__(self, *arg, **kw) 
     24        SOAPBindingError.__init__(self, *arg, **kw) 
    2225        self.__response = None 
    2326     
  • TI12-security/trunk/ndg_saml/ndg/saml/saml2/binding/soap/client/__init__.py

    r7165 r7259  
    221221        if isinstance(cfg, basestring): 
    222222            cfgFilePath = path.expandvars(cfg) 
    223             _cfg = SafeConfigParser() 
     223            hereDir = path.dirname(cfgFilePath) 
     224            _cfg = SafeConfigParser(defaults=dict(here=hereDir)) 
    224225            _cfg.optionxform = str 
    225226 
  • TI12-security/trunk/ndg_saml/ndg/saml/saml2/binding/soap/client/subjectquery.py

    r7143 r7259  
    222222        """Perform sanity check immediately before creating the query and  
    223223        sending it""" 
     224        errors = [] 
     225         
    224226        if self.issuerName is None: 
    225             raise AttributeError('No issuer name has been set for SAML Query') 
     227            errors.append('issuer name') 
    226228 
    227229        if self.issuerFormat is None: 
    228             raise AttributeError('No issuer format has been set for SAML Query') 
     230            errors.append('issuer format') 
    229231         
    230232        if self.subjectID is None: 
    231             raise AttributeError('No subject has been set for SAML Query') 
     233            errors.append('subject') 
    232234         
    233235        if self.subjectIdFormat is None: 
    234             raise AttributeError('No subject format has been set for SAML ' 
    235                                  'Query') 
     236            errors.append('subject format') 
     237         
     238        if errors: 
     239            raise AttributeError('Missing attribute(s) for SAML Query: %s' % 
     240                                 ', '.join(errors)) 
    236241 
    237242    def _initSend(self): 
  • TI12-security/trunk/ndg_saml/ndg/saml/xml/etree.py

    r7130 r7259  
    11411141        nameID = NameID() 
    11421142        nameID.format = format 
    1143         nameID.value = elem.text.strip()  
     1143        if elem.text is None: 
     1144            nameID.value = '' 
     1145        else: 
     1146            nameID.value = elem.text.strip()  
    11441147         
    11451148        return nameID 
Note: See TracChangeset for help on using the changeset viewer.