diff options
author | arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com> | 2021-04-08 10:58:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 10:58:38 -0700 |
commit | 0a83706c9d65f7d5a30ea3b42c5beac269ed2a25 (patch) | |
tree | d4f9460208e4d552eb260277c9e31012988dbfbc /google | |
parent | 6033e3080a9843f713c1cc925422e1f6810ae13a (diff) | |
download | google-auth-library-python-0a83706c9d65f7d5a30ea3b42c5beac269ed2a25.tar.gz |
fix: support custom alg in jwt header for signing (#729)
* fix: support custom alg in jwt header for signing
* lint
Diffstat (limited to 'google')
-rw-r--r-- | google/auth/jwt.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/google/auth/jwt.py b/google/auth/jwt.py index a4f04f5..8165dda 100644 --- a/google/auth/jwt.py +++ b/google/auth/jwt.py @@ -95,10 +95,11 @@ def encode(signer, payload, header=None, key_id=None): header.update({"typ": "JWT"}) - if es256 is not None and isinstance(signer, es256.ES256Signer): - header.update({"alg": "ES256"}) - else: - header.update({"alg": "RS256"}) + if "alg" not in header: + if es256 is not None and isinstance(signer, es256.ES256Signer): + header.update({"alg": "ES256"}) + else: + header.update({"alg": "RS256"}) if key_id is not None: header["kid"] = key_id |