Skip to content

Commit 8625052

Browse files
committed
Fix AttributeConsumingService
1 parent 5dc9958 commit 8625052

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/onelogin/saml2/metadata.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,13 @@ def builder(sp, authnsign=False, wsign=False, valid_until=None, cache_duration=N
139139
req_attr_isrequired_str = " isRequired=\"%s\"" % req_attribs['isRequired']
140140

141141
if 'attributeValue' in req_attribs.keys() and req_attribs['attributeValue']:
142-
req_attr_aux_str = ""
143142
if isinstance(req_attribs['attributeValue'], basestring):
144143
req_attribs['attributeValue'] = [req_attribs['attributeValue']]
144+
145+
req_attr_aux_str = ">"
145146
for attrValue in req_attribs['attributeValue']:
146147
req_attr_aux_str += """
147-
<saml:AttributeValue xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion>%(attributeValue)s</saml:AttributeValue>""" % \
148+
<saml:AttributeValue xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">%(attributeValue)s</saml:AttributeValue>""" % \
148149
{
149150
'attributeValue': attrValue
150151
}

tests/src/OneLogin/saml2_tests/metadata_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ def testBuilderAttributeConsumingServiceWithMultipleAttributeValue(self):
176176
self.assertIn(""" <md:AttributeConsumingService index="1">
177177
<md:ServiceName xml:lang="en">Test Service</md:ServiceName>
178178
<md:ServiceDescription xml:lang="en">Test Service</md:ServiceDescription>
179-
<md:RequestedAttribute Name="userType" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
180-
<saml:AttributeValue xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion>userType</saml:AttributeValue>
181-
<saml:AttributeValue xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion>admin</saml:AttributeValue>
179+
<md:RequestedAttribute Name="userType" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
180+
<saml:AttributeValue xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">userType</saml:AttributeValue>
181+
<saml:AttributeValue xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">admin</saml:AttributeValue>
182182
</md:RequestedAttribute>
183183
<md:RequestedAttribute Name="urn:oid:0.9.2342.19200300.100.1.1" FriendlyName="uid" />
184184
</md:AttributeConsumingService>""", metadata)

0 commit comments

Comments
 (0)