-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
PYTHON-3716 OIDC-SASL Follow-Up #1365
Conversation
blink1073
commented
Aug 30, 2023
•
edited
Loading
edited
- Use updated secrets handling from DRIVERS-2585 Migrate OIDC Secrets Handling mongodb-labs/drivers-evergreen-tools#345
- Use dedicated Atlas hosts for testing
- Move global cache to the mongo client level and update tests
- Clean up reauth logic in preparation for DRIVERS-2672
- Test on macos and Windows - requires DRIVERS-2616 Fix path handling for Windows mongodb-labs/drivers-evergreen-tools#349
- Enforce timeout on callback - we decided against this.
- Update specifications
Working locally with the Atlas hosts:
|
cc @durran |
.evergreen/run-tests.sh
Outdated
TEST_ARGS="test/auth_aws/test_auth_oidc.py" | ||
|
||
# Work around for root certifi not being installed. | ||
# TODO: Remove after PYTHON-3952 |
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.
Can this be removed now? If not can we open a new ticket so we don't forget?
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.
Updated to say "is deployed", I still need to coordinate that.
test/auth_aws/test_auth_oidc.py
Outdated
@@ -1,828 +0,0 @@ | |||
# Copyright 2023-present MongoDB, Inc. |
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.
Would you be able to rename this file in a separate commit to make this review easier?
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.
Done in #1378
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.
A couple minor comments, otherwise looks great!
if [ ! -f "./secrets-export.sh" ]; then | ||
bash .evergreen/tox.sh -m aws-secrets -- drivers/oidc | ||
fi | ||
source ./secrets-export.sh |
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.
Shouldn't this source
be under a set +x
for safety?
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.
Done
.evergreen/run-tests.sh
Outdated
@@ -255,6 +269,9 @@ fi | |||
# Show the installed packages | |||
PIP_QUIET=0 python -m pip list | |||
|
|||
python -c "import urllib.request;urllib.request.urlopen('https://www.google.com')" |
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.
What's the purpose of this line?
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.
That was for debugging, fixed
pymongo/auth_oidc.py
Outdated
timeout = CALLBACK_TIMEOUT_SECONDS | ||
if not use_callbacks and not current_valid_token: | ||
# TODO: DRIVERS-2672, handle machine callback here as well. | ||
cb = properties.request_token_callback |
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.
Minor nitpick, but this would be cleaner as a one-liner: cb = properties.request_token_callback if use_callback else None
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.
Done
pymongo/auth_oidc.py
Outdated
def reauthenticate(self, conn: Connection) -> Optional[Mapping[str, Any]]: | ||
"""Handle a reauthenticate from the server.""" | ||
# First see if we have the a newer token on the authenticator. | ||
prev_id = getattr(conn, "oidc_token_gen_id", 0) |
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.
Let's make oidc_token_gen_id a well defined property on Connection and avoid getattr.
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.
Ah, it was already there as an optional int, updated