-
Notifications
You must be signed in to change notification settings - Fork 30
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
Making all platform-dependent parameters optional #103
Conversation
Personally, I won't really fancy the idea of unifying everything to The original |
Related email discussion: Naming for service_name and account_name for MacOS token encryption |
52c71e9
to
3e75b23
Compare
@jiasli , did you mean to say that we can now promote this updated sample's helper |
3e75b23
to
c24c190
Compare
msal_extensions/persistence.py
Outdated
from .osx import Keychain, KeychainError # pylint: disable=import-outside-toplevel | ||
self._file_persistence = FilePersistence(signal_location) # Favor composition | ||
self._Keychain = Keychain # pylint: disable=invalid-name | ||
self._KeychainError = KeychainError # pylint: disable=invalid-name | ||
self._service_name = service_name | ||
self._account_name = account_name | ||
default_service_name = "Microsoft.Developer.IdentityService" # Stolen from azure-identity |
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.
Not sure if MSAL should comply with azure-identity
which is actually a downstream library of MSAL.
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 understand that name "Microsoft.Developer.IndentityService" is defined in downstream "azure-identity". Originally, I thought we could use any name so we might as well just backport the name used by "azure-identity".
But you raised a good point. We should NOT knowingly use any downstream specific service name here, because this open-source library msal-extensions
could potentially be used by app developers to store any information, and we/they probably do not want to store those data inside a specific downstream component's namespece. I'll send a new commit to use "msal-extensions"
as the default service name.
I have no strong opinion. Actually, Azure CLI would prefer not to use this |
d01c51b
to
8d66d25
Compare
8d66d25
to
cecb3ac
Compare
Tested with Azure CLI in Azure/azure-cli#20636 and it works perfectly. |
cecb3ac
to
42d482d
Compare
Changes in this PR
Az CLI uses 2 instances of persistence for different data, stored in different files. @jiasli found it unobvious that he would need to use different
service_name
andaccount_name
when running on mac. This PR attempts to hide/handle this detail, by automatically generate those 2 parameters based on the (signal) file location.Future ideas that are not (yet?) in this PR
Historically, before we introduced all those platform-dependent parameters, there was a unified
TokenCache
interface across all platforms.Later when we added (more and more) platform-dependent parameters, we attempted to keep a similar cross-platform
build_persistence()
helper but it did not really hide all those platform-dependent details, it merely becomes a union of all parameters.Therefore, @chlowell convinced us to remove that helper, and rightfully so:
Now, if this PR would be welcomed and merged, the next step would be reconsidering the introduction of a unified helper. This time, it won't need any platform-dependent parameters. Perhaps even a unified Persistence alias:
This way, the
EncryptedPersistence
would still be different classes with different signatures on different platforms, but at least their required parameters would be unified so that you could initialize one asEncryptedPersistence('/path/to/my/file.bin')
. And that would help resolvehttps://github.com/AzureAD/microsoft-authentication-extensions-for-python/issues/87
.@chlowell , @jiasli, thoughts?
UPDATE at 12/7/2021: We decided to reject proposal 3, because that alias would end up with different shapes. We postpone proposal 2 to a future release, after we gain some real-world usage with this PR.