@@ -77,7 +77,6 @@ def builder(sp, authnsign=False, wsign=False, valid_until=None, cache_duration=N
7777 organization = {}
7878
7979 str_attribute_consuming_service = ''
80-
8180 if 'attributeConsumingService' in sp and len (sp ['attributeConsumingService' ]):
8281 attr_cs_desc_str = ''
8382 if "serviceDescription" in sp ['attributeConsumingService' ]:
@@ -94,16 +93,22 @@ def builder(sp, authnsign=False, wsign=False, valid_until=None, cache_duration=N
9493 if 'friendlyName' in req_attribs .keys () and req_attribs ['friendlyName' ]:
9594 req_attr_nameformat_str = " FriendlyName=\" %s\" " % req_attribs ['friendlyName' ]
9695 if 'isRequired' in req_attribs .keys () and req_attribs ['isRequired' ]:
97- req_attr_isrequired_str = " isRequired=\" %s\" " % 'true' if req_attribs ['isRequired' ] else 'false'
96+ req_attr_isrequired_str = " isRequired=\" %s\" " % req_attribs ['isRequired' ]
97+
9898 if 'attributeValue' in req_attribs .keys () and req_attribs ['attributeValue' ]:
99- req_attr_aux_str = """ >
100- <saml:AttributeValue xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion>%(attributeValue)</saml:AttributeValue>
101- </md:RequestedAttribute>""" % \
102- {
103- 'attributeValue' : req_attribs ['attributeValue' ]
104- }
105-
106- requested_attribute = """ <md:RequestedAttribute Name="%(req_attr_name)s"%(req_attr_nameformat_str)s%(req_attr_isrequired_str)s%(req_attr_aux_str)s""" % \
99+ req_attr_aux_str = ""
100+ if isinstance (req_attribs ['attributeValue' ], basestring ):
101+ req_attribs ['attributeValue' ] = [req_attribs ['attributeValue' ]]
102+ for attrValue in req_attribs ['attributeValue' ]:
103+ req_attr_aux_str += """
104+ <saml:AttributeValue xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion>%(attributeValue)s</saml:AttributeValue>""" % \
105+ {
106+ 'attributeValue' : attrValue
107+ }
108+ req_attr_aux_str += """
109+ </md:RequestedAttribute>"""
110+
111+ requested_attribute = """ <md:RequestedAttribute Name="%(req_attr_name)s"%(req_attr_nameformat_str)s%(req_attr_friendlyname_str)s%(req_attr_isrequired_str)s%(req_attr_aux_str)s""" % \
107112 {
108113 'req_attr_name' : req_attribs ['name' ],
109114 'req_attr_nameformat_str' : req_attr_nameformat_str ,
0 commit comments