Skip to content

Commit 131d26d

Browse files
committed
Refactor to use new helper names
1 parent 44eb51f commit 131d26d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

msal/token_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import logging
55

66
from .authority import canonicalize
7-
from .oauth2cli.oidc import base64decode, decode_id_token
7+
from .oauth2cli.oidc import decode_part, decode_id_token
88

99

1010
logger = logging.getLogger(__name__)
@@ -124,7 +124,7 @@ def add(self, event, now=None):
124124
client_info = {}
125125
home_account_id = None # It would remain None in client_credentials flow
126126
if "client_info" in response: # We asked for it, and AAD will provide it
127-
client_info = json.loads(base64decode(response["client_info"]))
127+
client_info = json.loads(decode_part(response["client_info"]))
128128
home_account_id = "{uid}.{utid}".format(**client_info)
129129
elif id_token_claims: # This would be an end user on ADFS-direct scenario
130130
client_info["uid"] = id_token_claims.get("sub")

tests/test_assertion.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import json
22

3-
from msal.oauth2cli import JwtSigner
4-
from msal.oauth2cli.oidc import base64decode
3+
from msal.oauth2cli import JwtAssertionCreator
4+
from msal.oauth2cli.oidc import decode_part
55

66
from tests import unittest
77

88

99
class AssertionTestCase(unittest.TestCase):
1010
def test_extra_claims(self):
11-
assertion = JwtSigner(key=None, algorithm="none").sign_assertion(
11+
assertion = JwtAssertionCreator(key=None, algorithm="none").sign_assertion(
1212
"audience", "issuer", additional_claims={"client_ip": "1.2.3.4"})
13-
payload = json.loads(base64decode(assertion.split(b'.')[1].decode('utf-8')))
13+
payload = json.loads(decode_part(assertion.split(b'.')[1].decode('utf-8')))
1414
self.assertEqual("1.2.3.4", payload.get("client_ip"))
1515

0 commit comments

Comments
 (0)