Fxed: ID token does not contain kid #42

This commit is contained in:
Rob Sung 2015-08-11 23:50:05 -04:00
parent 3c6ab5c773
commit 19313e8145

View file

@ -4,6 +4,7 @@ import uuid
from Crypto.PublicKey.RSA import importKey from Crypto.PublicKey.RSA import importKey
from django.utils import timezone from django.utils import timezone
from hashlib import md5
from jwkest.jwk import RSAKey from jwkest.jwk import RSAKey
from jwkest.jws import JWS from jwkest.jws import JWS
@ -52,7 +53,8 @@ def encode_id_token(payload):
Return a hash. Return a hash.
""" """
keys = [ RSAKey(key=importKey(get_rsa_key())) ] key_string = get_rsa_key().encode('utf-8')
keys = [ RSAKey(key=importKey(key_string), kid=md5(key_string).hexdigest()) ]
_jws = JWS(payload, alg='RS256') _jws = JWS(payload, alg='RS256')
_jwt = _jws.sign_compact(keys) _jwt = _jws.sign_compact(keys)