python3: oidc authn backend jwk encoding

This commit is contained in:
Paul Marillonnet 2019-04-10 18:32:46 +02:00
parent 0e923ba857
commit b4ae98963d
1 changed files with 2 additions and 1 deletions

View File

@ -47,7 +47,8 @@ class OIDCBackend(ModelBackend):
key = list(key['keys'])[0]
algs = ['RS256', 'RS384', 'RS512']
elif provider.idtoken_algo == models.OIDCProvider.ALGO_HMAC:
key = JWK(kty='oct', k=base64url_encode(provider.client_secret.encode('utf-8')))
k = base64url_encode(provider.client_secret.encode('utf-8'))
key = JWK(kty='oct', k=k.decode('ascii'))
if not provider.client_secret:
logger.warning('auth_oidc: idtoken signature algorithm is HMAC but '
'no client_secret is defined on provider %s', id_token.iss)