Changeset 7165


Ignore:
Timestamp:
13/07/10 09:32:36 (9 years ago)
Author:
pjkersha
Message:

SAML SOAP binding code forked from ndg.security

Location:
TI12-security/trunk/ndg_saml/ndg/saml
Files:
3 edited

Legend:

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

    r7150 r7165  
    199199    def fromConfig(cls, cfg, **kw): 
    200200        '''Alternative constructor makes object from config file settings 
    201         @type cfg: basestring /ConfigParser derived type 
     201        @type cfg: basestring / ConfigParser derived type 
    202202        @param cfg: configuration file path or ConfigParser type object 
    203         @rtype: ndg.security.common.saml_utils.binding.soap.SOAPBinding 
     203        @rtype: ndg.saml.saml2.binding.soap.client.SOAPBinding or derived type 
    204204        @return: new instance of this class 
    205205        ''' 
     
    232232                                 'for "cfg" attribute; got %r type' % type(cfg)) 
    233233         
     234        # Get items for this section as a dictionary so that parseKeywords can 
     235        # used to update the object 
     236        kw = dict(_cfg.items(section)) 
     237        if 'prefix' not in kw and prefix: 
     238            kw['prefix'] = prefix 
     239             
     240        self.parseKeywords(**kw) 
     241         
     242    def parseKeywords(self, prefix='', **kw): 
     243        """Update object from input keywords 
     244         
     245        @type prefix: basestring 
     246        @param prefix: if a prefix is given, only update self from kw items  
     247        where keyword starts with this prefix 
     248        @type kw: dict 
     249        @param kw: items corresponding to class instance variables to  
     250        update.  Keyword names must match their equivalent class instance  
     251        variable names.  However, they may prefixed with <prefix> 
     252        """ 
    234253        prefixLen = len(prefix) 
    235         for optName, val in _cfg.items(section): 
     254        for optName, val in kw.items(): 
    236255            if prefix: 
    237256                # Filter attributes based on prefix 
     
    242261                setattr(self, optName, val) 
    243262                 
     263    @classmethod 
     264    def fromKeywords(cls, prefix='', **kw): 
     265        """Create a new instance initialising instance variables from the  
     266        keyword inputs 
     267        @type prefix: basestring 
     268        @param prefix: if a prefix is given, only update self from kw items  
     269        where keyword starts with this prefix 
     270        @type kw: dict 
     271        @param kw: items corresponding to class instance variables to  
     272        update.  Keyword names must match their equivalent class instance  
     273        variable names.  However, they may prefixed with <prefix> 
     274        @return: new instance of this class 
     275        @rtype: ndg.saml.saml2.binding.soap.client.SOAPBinding or derived type 
     276        """ 
     277        obj = cls() 
     278        obj.fromKeywords(prefix=prefix, **kw) 
     279         
     280        return obj 
     281         
    244282    def __setattr__(self, name, value): 
    245283        """Enable setting of SOAPBinding.client.responseEnvelopeClass as if it 
  • TI12-security/trunk/ndg_saml/ndg/saml/test/binding/soap/test_attributeservice.py

    r7154 r7165  
    160160 
    161161 
    162 class SOAPAttributeInterfaceMiddlewareTestCase( 
    163                                         WithPasteFixtureBaseTestCase): 
     162class SOAPAttributeInterfaceMiddlewareTestCase(WithPasteFixtureBaseTestCase): 
     163    """Test SAML Attribute Query over SOAP Binding querying a test attribute 
     164    server served using Paste Paster over HTTPS"""  
    164165    CONFIG_FILENAME = 'attribute-interface.ini' 
    165166    SERVICE_URI = '/attributeauthority' 
  • TI12-security/trunk/ndg_saml/ndg/saml/utils/m2crypto.py

    r7130 r7165  
    88__license__ = "http://www.apache.org/licenses/LICENSE-2.0" 
    99__contact__ = "Philip.Kershaw@stfc.ac.uk" 
    10 __revision__ = '$Id:$' 
     10__revision__ = '$Id$' 
    1111import logging 
    1212log = logging.getLogger(__name__) 
     
    13131313                 
    13141314            # No match found so return fail status 
     1315            log.debug("No match for peer certificate %s in DN whitelist %r", 
     1316                      x509Cert.dn, self.sslValidDNs) 
    13151317            return SSLContextProxy.PRE_VERIFY_FAIL 
    13161318         
Note: See TracChangeset for help on using the changeset viewer.