Projet

Général

Profil

0004-idp_oidc-render-templated-claims-in-user-info-creati.patch

Paul Marillonnet, 20 février 2020 16:53

Télécharger (1,54 ko)

Voir les différences:

Subject: [PATCH 4/6] idp_oidc: render templated claims in user-info-creation
 utilities (#37884)

 src/authentic2_idp_oidc/utils.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
src/authentic2_idp_oidc/utils.py
30 30

  
31 31
from authentic2 import hooks, crypto
32 32
from authentic2.attributes_ng.engine import get_attributes
33
from authentic2.utils.template import Template
33 34

  
34 35
from . import app_settings
35 36

  
......
196 197
        if not set(claim.get_scopes()).intersection(scope_set):
197 198
            continue
198 199
        claims_to_show.add(claim)
199
        if claim.value not in attributes:
200
            continue
201
        attribute_value = attributes[claim.value]
200
        if claim.is_templated:
201
            template = Template(claim.value)
202
            attribute_value = template.render(context=attributes)
203
        else:
204
            if claim.value not in attributes:
205
                continue
206
            attribute_value = attributes[claim.value]
202 207
        if attribute_value is None:
203 208
            continue
204 209
        user_info[claim.name] = normalize_claim_values(attribute_value)
205
-