Skip to content

MSAL Python 1.18.0b1 #471

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

Merged
merged 15 commits into from
May 19, 2022
Merged

MSAL Python 1.18.0b1 #471

merged 15 commits into from
May 19, 2022

Conversation

rayluo
Copy link
Collaborator

@rayluo rayluo commented May 19, 2022

rayluo and others added 14 commits February 11, 2022 12:30
Merge MSAL Python 1.17.0 back to dev branch
This way, it will probably show up properly in PyPI, too.
* implement response_mode

oidc supports passing the response_mode to allow redirects to send callback parameters as POST for increased security.

* Fix error check logic and modify test_ccs to include response_mode

* Add more comments

* Apply suggestions from code review

Co-authored-by: Ray Luo <[email protected]>

* PR review comments addressed

* remove extraneous line

Co-authored-by: Emmanuel Oche <[email protected]>
Co-authored-by: Ray Luo <[email protected]>
Emit warning when common or organizations is used in acquire_token_for_client()
Cloud Shell Detection

PoC: Silent flow utilizes Cloud Shell IMDS

Introduce get_accounts(username=msal.CURRENT_USER)

A reasonable-effort to convert scope to resource

Replace get_accounts(username=msal.CURRENT_USER) by acquire_token_interactive(..., prompt="none")

Detect unsupported Portal so that AzCLI could fallback
Bump cryptography
@rayluo rayluo force-pushed the release-1.18.0b1 branch from c9b0f17 to ea18829 Compare May 19, 2022 06:47
@rayluo rayluo merged commit bc13dd4 into main May 19, 2022
@rayluo rayluo deleted the release-1.18.0b1 branch May 31, 2022 19:46


def _is_running_in_cloud_shell():
return os.environ.get("AZUREPS_HOST_ENVIRONMENT", "").startswith("cloud-shell")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as an FYI, Azure CLI uses another env var ACC_CLOUD to detect if it is run in Cloud Shell:

https://github.com/Azure/azure-cli/blob/f0b5572c4ccafb383de08beb509045145fdc871f/src/azure-cli-core/azure/cli/core/util.py#L688

def in_cloud_console():
    return os.environ.get('ACC_CLOUD', None)
$ env | grep ACC_CLOUD
ACC_CLOUD=PROD

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dug this out from my chat messages history.

10/19/2021 11:54 AM
Ray: ... Az CLI and MSAL would need to detect whether they are currently running inside Cloud Shell. I confirmed with Robin that the recommended way is to use AZUREPS_HOST_ENVIRONMENT env var. I am just letting you know, to keep this env var in the future. Otherwise, its removal would become a breaking change for us. :-)

Edwin: I have previously advised folks to look for the ACC_CLOUD variable. Either should be OK

Ray: The "problem" of ACC_CLOUD is its content seems to vary by design, therefore the consumers would have to detect its presence, without any keyword in its value to "double check". I would prefer that "AZUREPS_HOST_ENVIRONMENT=cloud-shell/1.0" because we can then use some "value.startswith('cloud-shell')" logic just to be sure.
Either way, we just need your blessing to say "yes, that would become a formal contract that would last forever".

Edwin: ACC_CLOUD is a different value per-cloud (Public, Fairfax, etc). Other than that it is static. You can use the AZUREPS one if you like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants