Support MONGODB-AWS authentication mechanism
As of 3.11 (and MongoDB 4.4+), pymongo supports AWS IAM user/role based authentication:
https://pymongo.readthedocs.io/en/stable/examples/authentication.html#mongodb-aws
Support for this would be great to have in mongoengine as well.
This requires two things: setting the auth mechanism to MONGODB-AWS and passing authmechanismproperties into the authenticate method with the session token. The former is already possible, but support for authmechanismproperties is missing.
It would need to be populated in the connection settings and propagated to auth_kwargs in the code below.
https://github.com/MongoEngine/mongoengine/blob/96802599045432274481b4ed9fcc4fad4ce5f89b/mongoengine/connection.py#L355-L365
I can put together a PR for this to start a discussion about code, but I wanted to check first that you are open to supporting this?
HI @davidsteiner, sure, please open a PR that would be a good addition
This issue is a bit stale now, but we have had a requirement to use AWS authentication and I ended up following the suggestions on this card and it's now working. Would you be interested in me opening a PR for this?
Yep please do so 👍
The PR submitted allows connection using AWS credentials.
@bagerard Let me know if you want any changes done to the PR
Is there anything I can do / change to accelerate this being merged?
Sorry for the delay on this, just fixed and merge the PR. Let me know if you want me to release this quickly, happy to do so. Thanks for the contribution!