-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement remove_tokens_for_client() #666
Conversation
Interestingly, 666 is a positive/luckily number in Chinese, expressing "good" and "proficient": https://en.wikipedia.org/wiki/666_(number). |
[celebrate] Yong Zhang reacted to your message:
…________________________________
From: Jiashuo Li ***@***.***>
Sent: Wednesday, March 20, 2024 12:55:06 AM
To: AzureAD/microsoft-authentication-library-for-python ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [AzureAD/microsoft-authentication-library-for-python] Implement remove_tokens_for_client() (PR #666)
here comes this (evil?<https://en.wikipedia.org/wiki/Number_of_the_beast>) PR
Interestingly, 666 is a positive/luckily number in Chinese, expressing "good" and "proficient": https://en.wikipedia.org/wiki/666_(number).
—
Reply to this email directly, view it on GitHub<#666 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AM4LM2FYOGKXKGF6VSXGH6TYZDM6VAVCNFSM6AAAAABDFNEKNWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBYGQ3TGMRXGE>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
The implementation is not complete. After running
|
for at in self.token_cache.find(TokenCache.CredentialType.ACCESS_TOKEN, query={ | ||
"client_id": self.client_id, | ||
"environment": env, | ||
"home_account_id": None, # These are mostly app-only tokens | ||
}): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Luckily realm
(tenant) is not used in query
. This makes the functionality align with az logout
which only takes a --username
, but not --tenant
.
This means all access tokens for a service principal from all tenants will be removed. However, this brings up another question: what if I only want to remove the access token for a service principal in a specific tenant?
What if I lose track of service principals client IDs? How do I purge all service principals' access tokens, while keeping users' access tokens? |
Hmm, MSAL's
You would have to create different |
The residue of |
This is possible for user accounts logged into MSAL as users can be retrieved with
Azure CLI has a |
I agree the client ID for user authentication (such as Azure CLI's client ID) is not sensitive, but some users may treat service principal's client ID as sensitive date and want it to be "obliviated". |
Based on this understanding, here comes this (evil?) PR, which will resolve #640 and resolve #650