Projet

Général

Profil

0001-python3-oidc-authn-backend-jwk-encoding.patch

Paul Marillonnet, 24 avril 2019 15:27

Télécharger (1,46 ko)

Voir les différences:

Subject: [PATCH 1/2] python3: oidc authn backend jwk encoding

 src/authentic2_auth_oidc/backends.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/authentic2_auth_oidc/backends.py
7 7
from jwcrypto.jwk import JWK
8 8

  
9 9
from django.utils import six
10
from django.utils.encoding import force_text
10 11
from django.utils.timezone import now
11 12
from django.contrib.auth import get_user_model
12 13
from django.contrib.auth.backends import ModelBackend
......
47 48
                key = list(key['keys'])[0]
48 49
            algs = ['RS256', 'RS384', 'RS512']
49 50
        elif provider.idtoken_algo == models.OIDCProvider.ALGO_HMAC:
50
            key = JWK(kty='oct', k=base64url_encode(provider.client_secret.encode('utf-8')))
51
            k = base64url_encode(provider.client_secret.encode('utf-8'))
52
            key = JWK(kty='oct', k=force_text(k))
51 53
            if not provider.client_secret:
52 54
                logger.warning('auth_oidc: idtoken signature algorithm is HMAC but '
53 55
                               'no client_secret is defined on provider %s', id_token.iss)
54
-