mongoengine icon indicating copy to clipboard operation
mongoengine copied to clipboard

Support MONGODB-AWS authentication mechanism

Open davidsteiner opened this issue 4 years ago • 5 comments

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?

davidsteiner avatar Apr 23 '21 16:04 davidsteiner

HI @davidsteiner, sure, please open a PR that would be a good addition

bagerard avatar Apr 23 '21 18:04 bagerard

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?

mcsheehan avatar Apr 29 '22 16:04 mcsheehan

Yep please do so 👍

bagerard avatar Apr 29 '22 18:04 bagerard

The PR submitted allows connection using AWS credentials.

mcsheehan avatar May 16 '22 17:05 mcsheehan

@bagerard Let me know if you want any changes done to the PR

mcsheehan avatar May 19 '22 17:05 mcsheehan

Is there anything I can do / change to accelerate this being merged?

mcsheehan avatar Sep 06 '22 14:09 mcsheehan

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!

bagerard avatar Sep 06 '22 19:09 bagerard