python3: oidc client jwk secret encoding in tests (#32447)
This commit is contained in:
parent
a78d517a24
commit
a6dba11961
|
@ -30,6 +30,7 @@ from django.core.urlresolvers import reverse
|
|||
from django.core.files import File
|
||||
from django.db import connection
|
||||
from django.db.migrations.executor import MigrationExecutor
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.timezone import now
|
||||
from django.test.client import RequestFactory
|
||||
from django.contrib.auth import get_user_model
|
||||
|
@ -265,7 +266,8 @@ def test_authorization_code_sso(login_first, oidc_settings, oidc_client, simple_
|
|||
if oidc_client.idtoken_algo == oidc_client.ALGO_RSA:
|
||||
key = JWKSet.from_json(app.get(reverse('oidc-certs')).content)
|
||||
elif oidc_client.idtoken_algo == oidc_client.ALGO_HMAC:
|
||||
key = JWK(kty='oct', k=base64.b64encode(oidc_client.client_secret.encode('utf-8')))
|
||||
k = base64.b64encode(oidc_client.client_secret.encode('utf-8'))
|
||||
key = JWK(kty='oct', k=force_text(k))
|
||||
else:
|
||||
raise NotImplementedError
|
||||
jwt = JWT(jwt=id_token, key=key)
|
||||
|
@ -868,7 +870,8 @@ def test_role_control_access(login_first, oidc_settings, oidc_client, simple_use
|
|||
if oidc_client.idtoken_algo == oidc_client.ALGO_RSA:
|
||||
key = JWKSet.from_json(app.get(reverse('oidc-certs')).content)
|
||||
elif oidc_client.idtoken_algo == oidc_client.ALGO_HMAC:
|
||||
key = JWK(kty='oct', k=base64.b64encode(oidc_client.client_secret.encode('utf-8')))
|
||||
k = base64.b64encode(oidc_client.client_secret.encode('utf-8'))
|
||||
key = JWK(kty='oct', k=force_text(k))
|
||||
else:
|
||||
raise NotImplementedError
|
||||
jwt = JWT(jwt=id_token, key=key)
|
||||
|
|
Loading…
Reference in New Issue