File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -231,13 +231,15 @@ def _load_oid_token(self):
231
231
if len (parts ) != 3 : # Not a valid JWT
232
232
return None
233
233
234
+ padding = (4 - len (parts [1 ]) % 4 ) * '='
235
+
234
236
if PY3 :
235
237
jwt_attributes = json .loads (
236
- base64 .b64decode (parts [1 ]).decode ('utf-8' )
238
+ base64 .b64decode (parts [1 ] + padding ).decode ('utf-8' )
237
239
)
238
240
else :
239
241
jwt_attributes = json .loads (
240
- base64 .b64decode (parts [1 ] + "==" )
242
+ base64 .b64decode (parts [1 ] + padding )
241
243
)
242
244
243
245
expire = jwt_attributes .get ('exp' )
Original file line number Diff line number Diff line change @@ -87,11 +87,11 @@ def _raise_exception(st):
87
87
88
88
TEST_OIDC_TOKEN = "test-oidc-token"
89
89
TEST_OIDC_INFO = "{\" name\" : \" test\" }"
90
- TEST_OIDC_BASE = _base64 (TEST_OIDC_TOKEN ) + "." + _base64 (TEST_OIDC_INFO )
90
+ TEST_OIDC_BASE = _base64 (TEST_OIDC_TOKEN ). strip ( '=' ) + "." + _base64 (TEST_OIDC_INFO ). strip ( '=' )
91
91
TEST_OIDC_LOGIN = TEST_OIDC_BASE + "." + TEST_CLIENT_CERT_BASE64
92
92
TEST_OIDC_TOKEN = "Bearer %s" % TEST_OIDC_LOGIN
93
93
TEST_OIDC_EXP = "{\" name\" : \" test\" ,\" exp\" : 536457600}"
94
- TEST_OIDC_EXP_BASE = _base64 (TEST_OIDC_TOKEN ) + "." + _base64 (TEST_OIDC_EXP )
94
+ TEST_OIDC_EXP_BASE = _base64 (TEST_OIDC_TOKEN ). strip ( '=' ) + "." + _base64 (TEST_OIDC_EXP ). strip ( '=' )
95
95
TEST_OIDC_EXPIRED_LOGIN = TEST_OIDC_EXP_BASE + "." + TEST_CLIENT_CERT_BASE64
96
96
TEST_OIDC_CA = _base64 (TEST_CERTIFICATE_AUTH )
97
97
You can’t perform that action at this time.
0 commit comments