Ignore:
Timestamp:
12/02/10 17:05:04 (11 years ago)
Author:
pjkersha
Message:
  • Refactored classfactory module as a more generic factory for importing any module object
  • Started unit tests with refactored SAML SOAP bindings.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/saml_utils/binding/soap/subjectquery.py

    r6567 r6570  
    1313 
    1414from datetime import datetime, timedelta 
     15from uuid import uuid4 
    1516 
    1617from saml.common import SAMLObject 
    1718from saml.utils import SAMLDateTime 
    18 from saml.saml2.core import (Attribute, AttributeQuery, StatusCode, Response, 
     19from saml.saml2.core import (SubjectQuery, StatusCode, Response, 
    1920                             Issuer, Subject, SAMLVersion, NameID) 
    2021 
     22from ndg.security.common.utils import str2Bool 
    2123from ndg.security.common.saml_utils.binding.soap import (SOAPBinding, 
    2224    SOAPBindingInvalidResponse) 
     
    5557    SUBJECT_ID_OPTNAME = 'subjectID' 
    5658    ISSUER_NAME_OPTNAME = 'issuerName' 
     59    ISSUER_FORMAT_OPTNAME = 'issuerFormat' 
     60    SUBJECT_ID_FORMAT_OPTNAME = 'subjectIdFormat' 
    5761    CLOCK_SKEW_OPTNAME = 'clockSkewTolerance' 
    5862    VERIFY_TIME_CONDITIONS_OPTNAME = 'verifyTimeConditions' 
     
    6064    CONFIG_FILE_OPTNAMES = ( 
    6165        SUBJECT_ID_OPTNAME, 
    62         ISSUER_NAME_OPTNAME,                  
     66        SUBJECT_ID_FORMAT_OPTNAME, 
     67        ISSUER_NAME_OPTNAME,  
     68        ISSUER_FORMAT_OPTNAME,                 
    6369        CLOCK_SKEW_OPTNAME, 
    6470        VERIFY_TIME_CONDITIONS_OPTNAME             
     
    6672     
    6773    __PRIVATE_ATTR_PREFIX = "__" 
    68     __slots__ = tuple([__PRIVATE_ATTR_PREFIX + i  
    69                        for i in CONFIG_FILE_OPTNAMES]) 
     74    __slots__ = tuple([__PRIVATE_ATTR_PREFIX + i for i in CONFIG_FILE_OPTNAMES]) 
    7075    del i 
    7176     
     
    7479        self.__issuerName = None 
    7580        self.__issuerFormat = Issuer.X509_SUBJECT 
    76         self.__nameIdFormat = NameID.UNSPECIFIED 
     81        self.__subjectID = None 
     82        self.__subjectIdFormat = NameID.UNSPECIFIED 
    7783        self.__clockSkewTolerance = timedelta(seconds=0.) 
    7884        self.__verifyTimeConditions = True 
     
    8187 
    8288    def _getNameIdFormat(self): 
    83         return self.__nameIdFormat 
     89        return self.__subjectIdFormat 
    8490 
    8591    def _setNameIdFormat(self, value): 
    86         self.__nameIdFormat = value 
    87  
    88     nameIdFormat = property(_getNameIdFormat, _setNameIdFormat,  
     92        self.__subjectIdFormat = value 
     93 
     94    subjectIdFormat = property(_getNameIdFormat, _setNameIdFormat,  
    8995                            doc="Subject Name ID format") 
    9096 
     
    176182        @rtype: saml.saml2.core.SubjectQuery 
    177183        """ 
    178         if not isinstance(queryClass, SubjectQuery): 
     184        if not issubclass(queryClass, SubjectQuery): 
    179185            raise TypeError('Query class %r is not a SubjectQuery derived type' 
    180186                            % queryClass) 
     
    194200        query.subject = Subject()   
    195201        query.subject.nameID = NameID() 
    196         query.subject.nameID.format = self.nameIdFormat 
     202        query.subject.nameID.format = self.subjectIdFormat 
    197203        query.subject.nameID.value = self.subjectID 
    198204             
Note: See TracChangeset for help on using the changeset viewer.