Merge pull request #43 from rsung/v0.1.x
Fxed: ID token does not contain kid #42
This commit is contained in:
commit
5bb6fda0cc
1 changed files with 3 additions and 1 deletions
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue