Projet

Général

Profil

0001-python3-idp-oidc-test-client-jwk-secret-encoding-324.patch

Paul Marillonnet, 18 avril 2019 14:24

Télécharger (2,01 ko)

Voir les différences:

Subject: [PATCH] python3: idp oidc, test client jwk secret encoding (#32447)

 tests/test_idp_oidc.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tests/test_idp_oidc.py
13 13
from django.core.files import File
14 14
from django.db import connection
15 15
from django.db.migrations.executor import MigrationExecutor
16
from django.utils.encoding import force_text
16 17
from django.utils.timezone import now
17 18
from django.contrib.auth import get_user_model
18 19
from django.utils.six.moves.urllib import parse as urlparse
......
243 244
    if oidc_client.idtoken_algo == oidc_client.ALGO_RSA:
244 245
        key = JWKSet.from_json(app.get(reverse('oidc-certs')).content)
245 246
    elif oidc_client.idtoken_algo == oidc_client.ALGO_HMAC:
246
        key = JWK(kty='oct', k=base64.b64encode(oidc_client.client_secret.encode('utf-8')))
247
        k = base64.b64encode(oidc_client.client_secret.encode('utf-8'))
248
        key = JWK(kty='oct', k=force_text(k))
247 249
    else:
248 250
        raise NotImplementedError
249 251
    jwt = JWT(jwt=id_token, key=key)
......
846 848
    if oidc_client.idtoken_algo == oidc_client.ALGO_RSA:
847 849
        key = JWKSet.from_json(app.get(reverse('oidc-certs')).content)
848 850
    elif oidc_client.idtoken_algo == oidc_client.ALGO_HMAC:
849
        key = JWK(kty='oct', k=base64.b64encode(oidc_client.client_secret.encode('utf-8')))
851
        k = base64.b64encode(oidc_client.client_secret.encode('utf-8'))
852
        key = JWK(kty='oct', k=force_text(k))
850 853
    else:
851 854
        raise NotImplementedError
852 855
    jwt = JWT(jwt=id_token, key=key)
853
-