133
133
AA_ARGS = ["attribute" , "attribute_profile" ]
134
134
135
135
COMPLEX_ARGS = ["attribute_converters" , "metadata" , "policy" ]
136
- ALL = set (COMMON_ARGS + SP_ARGS + AA_IDP_ARGS + PDP_ARGS + COMPLEX_ARGS +
137
- AA_ARGS )
136
+ ALL = set (COMMON_ARGS + SP_ARGS + AA_IDP_ARGS + PDP_ARGS + COMPLEX_ARGS + AA_ARGS )
138
137
139
138
SPEC = {
140
- "" : COMMON_ARGS + COMPLEX_ARGS ,
141
- "sp" : COMMON_ARGS + COMPLEX_ARGS + SP_ARGS ,
139
+ "" : COMMON_ARGS + COMPLEX_ARGS ,
140
+ "sp" : COMMON_ARGS + COMPLEX_ARGS + SP_ARGS ,
142
141
"idp" : COMMON_ARGS + COMPLEX_ARGS + AA_IDP_ARGS ,
143
- "aa" : COMMON_ARGS + COMPLEX_ARGS + AA_IDP_ARGS + AA_ARGS ,
142
+ "aa" : COMMON_ARGS + COMPLEX_ARGS + AA_IDP_ARGS + AA_ARGS ,
144
143
"pdp" : COMMON_ARGS + COMPLEX_ARGS + PDP_ARGS ,
145
- "aq" : COMMON_ARGS + COMPLEX_ARGS + AQ_ARGS ,
144
+ "aq" : COMMON_ARGS + COMPLEX_ARGS + AQ_ARGS ,
146
145
}
147
146
148
147
_RPA = [BINDING_HTTP_REDIRECT , BINDING_HTTP_POST , BINDING_HTTP_ARTIFACT ]
149
148
_PRA = [BINDING_HTTP_POST , BINDING_HTTP_REDIRECT , BINDING_HTTP_ARTIFACT ]
150
- _SRPA = [BINDING_SOAP , BINDING_HTTP_REDIRECT , BINDING_HTTP_POST ,
151
- BINDING_HTTP_ARTIFACT ]
149
+ _SRPA = [BINDING_SOAP , BINDING_HTTP_REDIRECT , BINDING_HTTP_POST , BINDING_HTTP_ARTIFACT ]
152
150
153
151
PREFERRED_BINDING = {
154
152
"single_logout_service" : _SRPA ,
@@ -251,7 +249,7 @@ def getattr(self, attr, context=None):
251
249
else :
252
250
return getattr (self , "_%s_%s" % (context , attr ), None )
253
251
254
- def load_special (self , cnf , typ , metadata_construction = False ):
252
+ def load_special (self , cnf , typ ):
255
253
for arg in SPEC [typ ]:
256
254
try :
257
255
_val = cnf [arg ]
@@ -265,10 +263,10 @@ def load_special(self, cnf, typ, metadata_construction=False):
265
263
self .setattr (typ , arg , _val )
266
264
267
265
self .context = typ
268
- self .load_complex (cnf , typ , metadata_construction = metadata_construction )
266
+ self .load_complex (cnf , typ )
269
267
self .context = self .def_context
270
268
271
- def load_complex (self , cnf , typ = "" , metadata_construction = False ):
269
+ def load_complex (self , cnf , typ = "" ):
272
270
try :
273
271
self .setattr (typ , "policy" , Policy (cnf ["policy" ], config = self ))
274
272
except KeyError :
@@ -281,32 +279,6 @@ def load_complex(self, cnf, typ="", metadata_construction=False):
281
279
# except KeyError:
282
280
# pass
283
281
284
- try :
285
- try :
286
- acs = ac_factory (cnf ["attribute_map_dir" ])
287
- except KeyError :
288
- acs = ac_factory ()
289
-
290
- if not acs :
291
- raise ConfigurationError (
292
- "No attribute converters, something is wrong!!" )
293
-
294
- _acs = self .getattr ("attribute_converters" , typ )
295
- if _acs :
296
- _acs .extend (acs )
297
- else :
298
- self .setattr (typ , "attribute_converters" , acs )
299
-
300
- except KeyError :
301
- pass
302
-
303
- if not metadata_construction :
304
- try :
305
- self .setattr (typ , "metadata" ,
306
- self .load_metadata (cnf ["metadata" ]))
307
- except KeyError :
308
- pass
309
-
310
282
def unicode_convert (self , item ):
311
283
try :
312
284
return six .text_type (item , "utf-8" )
@@ -364,17 +336,25 @@ def load(self, cnf, metadata_construction=False):
364
336
if "service" in cnf :
365
337
for typ in ["aa" , "idp" , "sp" , "pdp" , "aq" ]:
366
338
try :
367
- self .load_special (
368
- cnf ["service" ][typ ], typ ,
369
- metadata_construction = metadata_construction )
339
+ self .load_special (cnf ["service" ][typ ], typ )
370
340
self .serves .append (typ )
371
341
except KeyError :
372
342
pass
373
343
374
344
if "extensions" in cnf :
375
345
self .do_extensions (cnf ["extensions" ])
376
346
377
- self .load_complex (cnf , metadata_construction = metadata_construction )
347
+ acs = ac_factory (cnf .get ("attribute_map_dir" ))
348
+ if not acs :
349
+ raise ConfigurationError ("No attribute converters, something is wrong!!" )
350
+ self .setattr ("" , "attribute_converters" , acs )
351
+
352
+ try :
353
+ self .setattr ("" , "metadata" , self .load_metadata (cnf ["metadata" ]))
354
+ except KeyError :
355
+ pass
356
+
357
+ self .load_complex (cnf )
378
358
self .context = self .def_context
379
359
380
360
return self
@@ -400,10 +380,8 @@ def load_metadata(self, metadata_conf):
400
380
""" Loads metadata into an internal structure """
401
381
402
382
acs = self .attribute_converters
403
-
404
383
if acs is None :
405
- raise ConfigurationError (
406
- "Missing attribute converter specification" )
384
+ raise ConfigurationError ("Missing attribute converter specification" )
407
385
408
386
try :
409
387
ca_certs = self .ca_certs
0 commit comments