217 |
217 |
if atv.any and len(atv.any) == 1 and isinstance(atv.any[0], lasso.MiscTextNode) and \
|
218 |
218 |
atv.any[0].textChild:
|
219 |
219 |
seen.add((name, name_format, atv.any[0].content.decode('utf-8')))
|
|
220 |
for definition in qs:
|
|
221 |
name, name_format = definition.name, definition.name_format
|
|
222 |
friendly_name = definition.friendly_name
|
|
223 |
if (name, name_format) not in attributes:
|
|
224 |
attribute, value = attributes[(name, name_format)] = lasso.Saml2Attribute(), []
|
|
225 |
attribute.friendlyName = friendly_name.encode('utf-8')
|
|
226 |
attribute.name = name.encode('utf-8')
|
|
227 |
attribute.nameFormat = name_format.encode('utf-8')
|
220 |
228 |
tuples = [tuple(t) for definition in qs for t in definition.to_tuples(ctx) ]
|
221 |
229 |
seen = set()
|
222 |
|
logger.info("%r", tuples)
|
223 |
230 |
for name, name_format, friendly_name, value in tuples:
|
224 |
231 |
# prevent repeating attribute values
|
225 |
232 |
if (name, name_format, value) in seen:
|
226 |
233 |
continue
|
227 |
234 |
seen.add((name, name_format, value))
|
228 |
|
if (name, name_format) in attributes:
|
229 |
|
attribute, values = attributes[(name, name_format)]
|
230 |
|
else:
|
231 |
|
attribute, values = attributes[(name, name_format)] = lasso.Saml2Attribute(), []
|
232 |
|
attribute.name = name.encode('utf-8')
|
233 |
|
attribute.nameFormat = name_format.encode('utf-8')
|
|
235 |
attribute, values = attributes[(name, name_format)]
|
|
236 |
|
234 |
237 |
# We keep only one friendly name
|
235 |
238 |
if not attribute.friendlyName and friendly_name:
|
236 |
239 |
attribute.friendlyName = friendly_name.encode('utf-8')
|
... | ... | |
240 |
243 |
atv.any = [tn]
|
241 |
244 |
values.append(atv)
|
242 |
245 |
for attribute, values in attributes.itervalues():
|
243 |
|
attribute.attributeValue = list(attribute.attributeValue) + values
|
|
246 |
attribute.attributeValue = values
|
244 |
247 |
attribute_statement.attribute = [attribute for attribute, values in attributes.itervalues()]
|
245 |
248 |
|
246 |
249 |
def saml2_add_attribute_values(assertion, attributes):
|
247 |
|
-
|