Projet

Général

Profil

0001-idp-oidc-skip-unset-attributes-in-user-info-23643.patch

Frédéric Péters, 07 mai 2018 19:38

Télécharger (1,72 ko)

Voir les différences:

Subject: [PATCH] idp oidc: skip unset attributes in user-info (#23643)

 src/authentic2_idp_oidc/utils.py | 2 ++
 tests/test_idp_oidc.py           | 6 ++++++
 2 files changed, 8 insertions(+)
src/authentic2_idp_oidc/utils.py
172 172
    for claim in client.oidcclaim_set.filter(name__isnull=False):
173 173
        if not set(claim.get_scopes()).intersection(scope_set):
174 174
            continue
175
        if not claim.value in attributes:
176
            continue
175 177
        user_info[claim.name] = normalize_claim_values(attributes[claim.value])
176 178
        # check if attribute is verified
177 179
        if claim.value + ':verified' in attributes:
tests/test_idp_oidc.py
253 253
    assert response.json['ou'] == simple_user.ou.name
254 254
    assert response.json['roles'][0] == 'Whatever'
255 255

  
256
    # check against a user without username
257
    simple_user.username = None
258
    simple_user.save()
259
    response = app.get(user_info_url, headers=bearer_authentication_headers(access_token))
260
    assert 'preferred_username' not in response.json
261

  
256 262
    # Now logout
257 263
    if oidc_client.post_logout_redirect_uris:
258 264
        params = {
259
-