Skip to content

Commit

Permalink
Merge branch 'improve-logs' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
rayluo committed Jun 13, 2023
2 parents b96489d + 6b2f337 commit 7aa2078
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion msal/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ def _str2bytes(raw):
return raw


def _pii_less_home_account_id(home_account_id):
parts = home_account_id.split(".") # It could contain one or two parts
parts[0] = "********"
return ".".join(parts)


def _clean_up(result):
if isinstance(result, dict):
return {
Expand Down Expand Up @@ -1460,7 +1466,10 @@ def _acquire_token_silent_by_finding_specific_refresh_token(
self.token_cache.CredentialType.REFRESH_TOKEN,
# target=scopes, # AAD RTs are scope-independent
query=query)
logger.debug("Found %d RTs matching %s", len(matches), query)
logger.debug("Found %d RTs matching %s", len(matches), {
k: _pii_less_home_account_id(v) if k == "home_account_id" and v else v
for k, v in query.items()
})

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

0 comments on commit 7aa2078

Please sign in to comment.