Skip to content

Commit 7aa2078

Browse files
committed
Merge branch 'improve-logs' into dev
2 parents b96489d + 6b2f337 commit 7aa2078

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

msal/application.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ def _str2bytes(raw):
6565
return raw
6666

6767

68+
def _pii_less_home_account_id(home_account_id):
69+
parts = home_account_id.split(".") # It could contain one or two parts
70+
parts[0] = "********"
71+
return ".".join(parts)
72+
73+
6874
def _clean_up(result):
6975
if isinstance(result, dict):
7076
return {
@@ -1460,7 +1466,10 @@ def _acquire_token_silent_by_finding_specific_refresh_token(
14601466
self.token_cache.CredentialType.REFRESH_TOKEN,
14611467
# target=scopes, # AAD RTs are scope-independent
14621468
query=query)
1463-
logger.debug("Found %d RTs matching %s", len(matches), query)
1469+
logger.debug("Found %d RTs matching %s", len(matches), {
1470+
k: _pii_less_home_account_id(v) if k == "home_account_id" and v else v
1471+
for k, v in query.items()
1472+
})
14641473

14651474
response = None # A distinguishable value to mean cache is empty
14661475
if not matches: # Then exit early to avoid expensive operations

0 commit comments

Comments
 (0)