Ignore:
Timestamp:
16/02/10 16:11:08 (11 years ago)
Author:
pjkersha
Message:
  • Important fix for SOAP client used with SAML SOAP binding: set text/xml content type.
  • Refactored SAML SOAP binding query clients.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/saml_utils/esg/xml/etree.py

    r6069 r6578  
    1616 
    1717from saml.xml import XMLTypeParseError, UnknownAttrProfile 
    18 from saml.xml.etree import AttributeValueElementTreeBase, QName 
     18from saml.xml.etree import (AttributeValueElementTreeBase, ResponseElementTree, 
     19                            QName) 
    1920 
    2021from ndg.security.common.saml_utils.esg import XSGroupRoleAttributeValue 
     
    138139        return None 
    139140 
     141 
     142class EsgResponseElementTree(ResponseElementTree): 
     143    """Extend ResponseElementTree type for Attribute Query Response to include  
     144    ESG custom Group/Role Attribute support""" 
     145     
     146    @classmethod 
     147    def toXML(cls, response, **kw): 
     148        # Add mapping for ESG Group/Role Attribute Value to enable ElementTree 
     149        # Attribute Value factory to render the XML output 
     150        toXMLTypeMap = kw.get('customToXMLTypeMap', {}) 
     151        toXMLTypeMap[XSGroupRoleAttributeValue 
     152                     ] = XSGroupRoleAttributeValueElementTree 
     153         
     154        kw['customToXMLTypeMap'] = toXMLTypeMap 
     155         
     156        # Convert to ElementTree representation to enable attachment to SOAP 
     157        # response body 
     158        return ResponseElementTree.toXML(response, **kw) 
     159     
     160    @classmethod 
     161    def fromXML(cls, elem, **kw): 
     162        toSAMLTypeMap = kw.get('customToSAMLTypeMap', []) 
     163        toSAMLTypeMap.append( 
     164                        XSGroupRoleAttributeValueElementTree.factoryMatchFunc) 
     165        kw['customToSAMLTypeMap'] = toSAMLTypeMap 
     166         
     167        return ResponseElementTree.fromXML(elem, **kw) 
Note: See TracChangeset for help on using the changeset viewer.