Changeset 7335
- Timestamp:
- 18/08/10 10:06:33 (11 years ago)
- Location:
- TI12-security/trunk/NDGSecurity/python
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/NDGSecurity/python/ndg_security_server/ndg/security/server/xacml/ctx_handler/saml_ctx_handler.py
r7330 r7335 104 104 obj.parseConfig(cfg, **kw) 105 105 106 # Post initialisation steps - load policy and PIP mapping file 106 107 if obj.policyFilePath: 107 108 obj.pdp = PDP.fromPolicySource(obj.policyFilePath, 108 109 XacmlPolicyReaderFactory) 110 111 if obj.pip.mappingFilePath: 112 obj.pip.readMappingFile() 109 113 110 114 return obj … … 201 205 obj.parseKeywords(prefix=prefix, **kw) 202 206 207 # Post initialisation steps - load policy and PIP mapping file 203 208 if obj.policyFilePath: 204 209 obj.pdp = PDP.fromPolicySource(obj.policyFilePath, 205 210 XacmlPolicyReaderFactory) 206 211 212 if obj.pip.mappingFilePath: 213 obj.pip.readMappingFile() 214 207 215 return obj 208 216 -
TI12-security/trunk/NDGSecurity/python/ndg_security_server/ndg/security/server/xacml/pip/saml_pip.py
r7327 r7335 31 31 32 32 33 class PIPException(Exception): 34 """Base exception type for XACML PIP (Policy Information Point) class""" 35 36 37 class PIPConfigException(PIPException): 38 """Configuration errors related to the XACML PIP (Policy Information Point) 39 class 40 """ 41 42 43 class PIPRequestCtxException(PIPException): 44 """Error with request context passed to XACML PIP object's attribute query 45 """ 46 47 33 48 class PIP(PIPInterface): 34 49 '''Policy Information Point enables XACML PDP to query for additional user … … 56 71 '__subjectAttributeId', 57 72 '__mappingFilePath', 58 '__attribute 2AttributeAuthorityMap',73 '__attributeId2AttributeAuthorityMap', 59 74 '__attributeQueryBinding' 60 75 ) … … 67 82 # Force mapping dict to have string type keys and items 68 83 _typeCheckers = (lambda val: isinstance(val, basestring),)*2 69 self.__attribute 2AttributeAuthorityMap = VettedDict(*_typeCheckers)84 self.__attributeId2AttributeAuthorityMap = VettedDict(*_typeCheckers) 70 85 71 86 self.__attributeQueryBinding = AttributeQuerySslSOAPBinding() … … 105 120 106 121 attribute2AttributeAuthorityMap = property( 107 fget=lambda self: self.__attribute 2AttributeAuthorityMap,122 fget=lambda self: self.__attributeId2AttributeAuthorityMap, 108 123 doc="Mapping from attribute Id to attribute authority " 109 124 "endpoint") … … 204 219 if _line and not _line.startswith('#'): 205 220 attributeId, attributeAuthorityURI = _line.split() 206 self.__attribute 2AttributeAuthorityMap[attributeId221 self.__attributeId2AttributeAuthorityMap[attributeId 207 222 ] = attributeAuthorityURI 208 223 … … 219 234 @return: attribute values found for query subject or None if none 220 235 could be found 236 @raise PIPConfigException: if attribute ID -> Attribute Authority mapping is 237 empty 221 238 """ 222 239 … … 237 254 # Look up mapping from request attribute ID to Attribute Authority to 238 255 # query 239 attributeAuthorityURI = self.__attribute2AttributeAuthorityMap.get( 256 if len(self.__attributeId2AttributeAuthorityMap) == 0: 257 raise PIPConfigException('No entries found in attribute ID to ' 258 'Attribute Authority mapping') 259 260 attributeAuthorityURI = self.__attributeId2AttributeAuthorityMap.get( 240 261 attributeDesignator.attributeId, 241 262 None) … … 260 281 261 282 if subjectId is None: 262 # TODO: parameterise data type setting263 raise Exception('No subject found of type %r inrequest context' %264 'urn:esg:openid')283 raise PIPRequestCtxException('No subject found of type %r in ' 284 'request context' % 285 self.subjectAttributeId) 265 286 else: 266 287 # Keep a reference to the matching Subject instance … … 281 302 response = self.attributeQueryBinding.send( 282 303 uri=attributeAuthorityURI) 304 except Exception: 305 log.exception('Error querying Attribute service %r with subject %r', 306 attributeAuthorityURI, 307 subjectId) 308 raise 283 309 finally: 284 310 # !Ensure relevant query attributes are reset ready for any -
TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/config/authorisationservice/policy.xml
r7287 r7335 107 107 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of"> 108 108 <SubjectAttributeDesignator 109 AttributeId="urn: ndg:security:authz:1.0:attr"109 AttributeId="urn:siteA:security:authz:1.0:attr" 110 110 DataType="http://www.w3.org/2001/XMLSchema#string"/> 111 111 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-bag"> … … 133 133 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of"> 134 134 <SubjectAttributeDesignator 135 AttributeId="urn: ndg:security:authz:1.0:attr"135 AttributeId="urn:siteA:security:authz:1.0:attr" 136 136 DataType="http://www.w3.org/2001/XMLSchema#string"/> 137 137 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-bag"> 138 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string"> staff</AttributeValue>139 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string"> administrator</AttributeValue>138 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">urn:siteA:security:authz:1.0:attr:staff</AttributeValue> 139 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">urn:siteA:security:authz:1.0:attr:postdoc</AttributeValue> 140 140 </Apply> 141 141 </Apply> … … 163 163 <SubjectMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"> 164 164 <SubjectAttributeDesignator 165 AttributeId="urn: ndg:security:authz:1.0:attr"165 AttributeId="urn:siteA:security:authz:1.0:attr" 166 166 DataType="http://www.w3.org/2001/XMLSchema#string"/> 167 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string"> administrator</AttributeValue>167 <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">urn:siteA:security:authz:1.0:attr:admin</AttributeValue> 168 168 </SubjectMatch> 169 169 </Subject> -
TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/unit/__init__.py
r7327 r7335 124 124 'urn:siteA:security:authz:1.0:attr:undergrad', 125 125 'urn:siteA:security:authz:1.0:attr:coapec', 126 'urn:siteA:security:authz:1.0:attr:rapid' 126 'urn:siteA:security:authz:1.0:attr:rapid', 127 'urn:siteA:security:authz:1.0:attr:admin' 127 128 ) 128 129 N_ATTRIBUTE_VALUES = len(ATTRIBUTE_VALUES)
Note: See TracChangeset
for help on using the changeset viewer.