-
Notifications
You must be signed in to change notification settings - Fork 3k
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
{Core} Only pass data
to MSAL as kwargs
#30062
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As of this PR, it looks like we don't need that
filtered_kwargs
at all.Open question:
Currently there are multiple
get_token(..., **kwargs)
function scattering here and there. If/since we say - via this PR - that onlydata
is an expected input parameter, why don't we take one step further and refactor those functions toget_token(..., data=None)
?Even if we somehow still want to accept and then ignore arbitrary parameters, a more readable pattern is
def get_token(..., data=None, **ignored)
and then we do NOT relay theignored
into underlying functions.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.
The reason why I don't use
data=kwargs.get("data")
is because this will causedata
always to be passed, even asNone
. I want to make suredata
is passed only when the caller ofget_token
passesdata
.As for not making
data
a public argument, this is because Azure CLI Core is also used by other people or projects, I don't want to makedata
a public argument before MSAL does the same (AzureAD/microsoft-authentication-library-for-python#755).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.
Fair enough. In that case, I would suggest you put that reasoning as a comment at the line of
filtered_kwargs
, to prevent a future maintainer refactoring it to the simpler way.Good point. This PR is ready to go as-is, without AzureAD/microsoft-authentication-library-for-python#755 (If we are really going to expose that in MSAL, we will revisit its naming.)
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.
I am the only one maintaining this part. Let's keep it as is, as I will change it soon.
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.
One silly question, are
tenant_id
anddata
the only knownkwargs
that might be passed toget_token
currently?def get_token(self, *scopes, **kwargs)
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.
We only support
scopes
anddata
, but nottenant_id
,enable_cae
. That's why anything else inkwargs
is discarded.