Merge pull request #43 from rsung/v0.1.x

Fxed: ID token does not contain kid #42
This commit is contained in:
Juan Ignacio Fiorentino 2015-08-12 12:29:37 -03:00
commit 5bb6fda0cc

View file

@ -4,6 +4,7 @@ import uuid
from Crypto.PublicKey.RSA import importKey
from django.utils import timezone
from hashlib import md5
from jwkest.jwk import RSAKey
from jwkest.jws import JWS
@ -52,7 +53,8 @@ def encode_id_token(payload):
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')
_jwt = _jws.sign_compact(keys)