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/binding/soap/authzdecisionquery.py

    r6572 r6578  
    1717from saml.saml2.core import AuthzDecisionQuery 
    1818 
    19 from ndg.security.common.sam_utils.binding.soap.subjectquery import ( 
     19from ndg.security.common.saml_utils.binding.soap.subjectquery import ( 
    2020                                                    SubjectQuerySOAPBinding, 
    2121                                                    SubjectQueryResponseError) 
     
    4040    Nb. Assumes X.509 subject type for query issuer 
    4141    """ 
    42     __slots__ = () 
     42    SERIALISE_KW = 'serialise' 
     43    DESERIALISE_KW = 'deserialise' 
     44    QUERY_TYPE = AuthzDecisionQuery 
     45    __slots__ = ('__resourceURI', '__action', '__actionNs') 
    4346     
    4447    def __init__(self, **kw): 
    4548        '''Create SOAP Client for SAML Authorization Decision Query''' 
     49        cls = AuthzDecisionQuerySOAPBinding 
     50         
     51        # Default to ElementTree based serialisation/deserialisation 
     52        if cls.SERIALISE_KW not in kw: 
     53            from saml.xml.etree import AuthzDecisionQueryElementTree 
     54            kw[cls.SERIALISE_KW] = AuthzDecisionQueryElementTree.toXML 
     55                
     56        if cls.DESERIALISE_KW not in kw: 
     57            from saml.xml.etree import ResponseElementTree 
     58            kw[cls.DESERIALISE_KW] = ResponseElementTree.fromXML 
     59 
    4660        super(AuthzDecisionQuerySOAPBinding, self).__init__(**kw) 
    4761 
     62    def _getResourceURI(self): 
     63        return self.query.resource 
     64 
     65    def _setResourceURI(self, value): 
     66        self.query.resource = value 
     67         
     68    resourceURI = property(_getResourceURI, _setResourceURI,  
     69                           doc="Resource URI to query for access") 
    4870     
    49     def _createQuery(self): 
    50         """Specialisation to force creation of AuthzDecisionQuery type instead 
    51         of SubjectQuery 
    52         """ 
    53         return super(AuthzDecisionQuerySOAPBinding, self)._createQuery( 
    54                                                             AuthzDecisionQuery)  
     71    @property 
     72    def actions(self): 
     73        return self.query.actions 
    5574 
    5675     
Note: See TracChangeset for help on using the changeset viewer.