Révision e5e03418
Ajouté par Frédéric Péters il y a presque 8 ans
extra/modules/saml2.py | ||
---|---|---|
111 | 111 |
if login and login.identity: |
112 | 112 |
user.lasso_dump = login.identity.dump() |
113 | 113 |
|
114 |
lasso_session = lasso.Session.newFromDump(session.lasso_session_dump) |
|
115 |
assertion = lasso_session.getAssertions(None)[0] |
|
116 |
for attribute in assertion.attributeStatement[0].attribute: |
|
117 |
if attribute.name == 'verified_attributes': |
|
118 |
verified_attributes = [x.any[0].content for x in attribute.attributeValue] |
|
119 |
if verified_attributes: |
|
120 |
# XXX: if there are any verified attributes we consider |
|
121 |
# first and last names are also verified. This is to work |
|
122 |
# around the fact that those attributes are handled |
|
123 |
# differently in authentic and cannot be marked as |
|
124 |
# verified. |
|
125 |
verified_attributes.extend(['first_name', 'last_name']) |
|
126 |
verified_fields = [] |
|
127 |
if user.get_formdef() and user.get_formdef().fields: |
|
128 |
for field in user.get_formdef().fields: |
|
129 |
if field.varname in verified_attributes: |
|
130 |
verified_fields.append(field.id) |
|
131 |
user.verified_fields = verified_fields |
|
132 |
break |
|
133 |
|
|
114 | 134 |
user.store() |
115 | 135 |
return user |
Formats disponibles : Unified diff
saml: add verified fields in user profile (#12366)