-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Update msgraph.py to_msal_proxies #61199
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
base: main
Are you sure you want to change the base?
Conversation
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 too familiar with the Azure provider yet, but I'm a bit concerned due to the lack of unit tests.
I'll be happy if you could add some, at least for this method as it had already 4 if statements, non of which unit tested - which could potentially lead to unnoticed regression in the future.
Thanks for testing it on your environment though!
|
hello @shahar1, At least I ran added tests directly over the changed code and all of them were successful. |
Will also check the PR and come back to you. |
msal_proxies is only supposed to return proxies if an authority is defined, otherwise I don't think it's supposed to return any proxies. |
|
I would leave the logic as is, but the addition of tests is a very good think though, so I would keep the PR, revert the msal proxies logic to original, and you'll probably need to adapt assert of one test when authority is None. |
|
Hello @dabla , In our internal testing this update worked fine even without authority attribute in connection. But maybe I am missing the whole logic, but method get_credentials in the same msgraph.py hook file is using msal_proxies value for ClientSecretCredential:
|
|
Hello @dabla,
After that proxy authentication is working well even with the original code. However I would recommend to update a documentation when the client wants to use a proxy connectivity. It is a little bit confusing how the proxies are transformed and finally passed when connecting to a Microsoft services in my opinion. You have to go deep to the code to understand whole logic. I updated the comment in the linked issue. If you want I am open to update the unit tests in this PR. :-) |
Hello @morelgeorge thank you for the explanation, very well investigation. We can keep the PR as is, after some thought I think the authority check doesn't make sense indeed and is confusing, because even if you don't define it, the default Microsoft one will be applied so your PR is fine. Thanks again! |
|
You'll have to fix static checks though, then I think we can merge it. |
|
Can you please amend commit message to describe the bug you fix? We generate release notes from commit messages so it's important. |
Updated the logic of function to_msal_proxies. Return proxies attribute even when the authority is not filled
*closes: #61197
To be honest, this PR is only a draft. From the Code I can see that Authority can be retrieved from connection as an extra parameter. However, there is no information about it in the documentation.
So, this is a little bit confusing when using the proxy. So I propose to update the logic of a function to_msal_proxies. Return proxies attribute even when the variable authority is not filled.
Testing
In our environment I did a functional logic test with and without proxy. It works as expected