Skip to content

Commit 6ffa587

Browse files
committed
You may want to add extra claims to the JWT header.
1 parent 2462a4b commit 6ffa587

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_06_jws.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,3 +783,14 @@ def test_extra_headers_2():
783783
sjwt = _jws.sign_compact(keys)
784784
_jwt = factory(sjwt)
785785
assert set(_jwt.jwt.headers.keys()) == {'alg', 'foo'}
786+
787+
788+
def test_extra_headers_3():
789+
pkey = import_private_rsa_key_from_file(full_path("./size2048.key"))
790+
payload = "Please take a moment to register today"
791+
keys = [RSAKey(priv_key=pkey)]
792+
_jws = JWS(payload, alg='RS256')
793+
_jws.set_header_claim('foo', 'bar')
794+
sjwt = _jws.sign_compact(keys, abc=123)
795+
_jwt = factory(sjwt)
796+
assert set(_jwt.jwt.headers.keys()) == {'alg', 'foo', 'abc'}

0 commit comments

Comments
 (0)