@@ -239,15 +239,19 @@ def do_key_descriptor(cert=None, enc_cert=None, use="both"):
239
239
return kd_list
240
240
241
241
242
- def do_requested_attribute (attributes , acs , is_required = "false" ):
242
+ def do_requested_attribute (attributes , acs , is_required = "false" ,
243
+ name_format = NAME_FORMAT_URI ):
243
244
lista = []
244
245
for attr in attributes :
245
- attr = from_local_name (acs , attr , NAME_FORMAT_URI )
246
+ attr = from_local_name (acs , attr , name_format )
246
247
args = {}
247
- for key in attr .keyswv ():
248
- args [key ] = getattr (attr , key )
248
+ if isinstance (attr , six .string_types ):
249
+ args ["name" ] = attr
250
+ else :
251
+ for key in attr .keyswv ():
252
+ args [key ] = getattr (attr , key )
249
253
args ["is_required" ] = is_required
250
- args ["name_format" ] = NAME_FORMAT_URI
254
+ args ["name_format" ] = name_format
251
255
lista .append (md .RequestedAttribute (** args ))
252
256
return lista
253
257
@@ -465,14 +469,21 @@ def do_attribute_consuming_service(conf, spsso):
465
469
requested_attributes = []
466
470
acs = conf .attribute_converters
467
471
req = conf .getattr ("required_attributes" , "sp" )
472
+
473
+ req_attr_name_format = conf .getattr ("requested_attribute_name_format" , "sp" )
474
+ if req_attr_name_format is None :
475
+ req_attr_name_format = conf .requested_attribute_name_format
476
+
468
477
if req :
469
- requested_attributes .extend (do_requested_attribute (req , acs ,
470
- is_required = "true" ))
478
+ requested_attributes .extend (
479
+ do_requested_attribute (req , acs , is_required = "true" ,
480
+ name_format = req_attr_name_format ))
471
481
472
482
opt = conf .getattr ("optional_attributes" , "sp" )
473
483
474
484
if opt :
475
- requested_attributes .extend (do_requested_attribute (opt , acs ))
485
+ requested_attributes .extend (
486
+ do_requested_attribute (opt , acs , name_format = req_attr_name_format ))
476
487
477
488
try :
478
489
if conf .description :
0 commit comments