Skip to content

Commit 7b8f6f5

Browse files
committed
refactor
1 parent 09c017e commit 7b8f6f5

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

msal/token_cache.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,13 @@ def add(self, event, now=None):
122122
decode_id_token(id_token, client_id=event["client_id"])
123123
if id_token else {})
124124
client_info = {}
125+
home_account_id = None # It would remain None in client_credentials flow
125126
if "client_info" in response: # We asked for it, and AAD will provide it
126127
client_info = json.loads(base64decode(response["client_info"]))
127-
home_account_id = (
128-
# It would remain None in client_credentials flow
129-
"{uid}.{utid}".format(**client_info) if client_info else None)
128+
home_account_id = "{uid}.{utid}".format(**client_info)
130129
elif id_token_claims: # This would be an end user on ADFS-direct scenario
131-
client_info = {
132-
"uid": id_token_claims.get("sub"),
133-
}
134-
home_account_id = (
135-
"{uid}".format(**client_info))
130+
client_info["uid"] = id_token_claims.get("sub")
131+
home_account_id = id_token_claims.get("sub")
136132

137133
target = ' '.join(event.get("scope", [])) # Per schema, we don't sort it
138134

0 commit comments

Comments
 (0)