Skip to content
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

DOCSP-40811 Authentication Mechanisms #22

Conversation

jordan-smith721
Copy link
Collaborator

Copy link
Collaborator

@mcmorisi mcmorisi left a comment

Choose a reason for hiding this comment

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

Good stuff! A smattering of nitpicks, but LGTM otherwise!

source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
Comment on lines +131 to +133
- ``username``: The AWS IAM access key ID to authenticate.
- ``password``: The AWS IAM secret access key.
- ``authMechanism``: Set to ``"MONGODB-AWS"``.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Clarification for my sake: Because the third list item here is in imperative form and therefore warrants a period, the style guide dictates that a period follows all items in this list – am I correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, exactly

source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/enterprise-authentication.txt Outdated Show resolved Hide resolved
Comment on lines 89 to 90
You must replace the ``@`` symbol in the URI string with ``%40``, as shown
in the preceding example.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like there are two @ symbols, only one of which gets encoded to %40. This might make it more clear.

Suggested change
You must replace the ``@`` symbol in the URI string with ``%40``, as shown
in the preceding example.
You must replace the first ``@`` symbol in the URI string with ``%40``, as shown
in the preceding example.

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 reworded to refer to the principal instead of the URI, which I think is more accurate

@jordan-smith721 jordan-smith721 changed the base branch from master to cpp-standardization June 26, 2024 22:15
@kevinAlbs kevinAlbs requested a review from kkloberdanz June 27, 2024 17:30

1. Named parameters passed to the Connection URI
#. Environment variables
#. ECS container metadata
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest noting EKS. As of DRIVERS-1746, drivers also check for environment variables set in EKS environments. See: the auth spec section AssumeRoleWithWebIdentity for a description.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added a section on AssumeRoleWithWebIdentity

Comment on lines 32 to 33
auto uri = mongocxx::uri("mongodb://<AWS IAM access key ID>:<AWS IAM secret access key>@<hostname>:<port>/?"
"&authMechanism=MONGODB-AWS");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
auto uri = mongocxx::uri("mongodb://<AWS IAM access key ID>:<AWS IAM secret access key>@<hostname>:<port>/?"
"&authMechanism=MONGODB-AWS");
auto uri = mongocxx::uri("mongodb://<AWS IAM access key ID>:<AWS IAM secret access key>@<hostname>:<port>/?"
"authMechanism=MONGODB-AWS");

Remove extra & to prevent error: URI option "" contains no "=" sign: an invalid MongoDB URI was provided

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, thanks!

#include <mongocxx/uri.hpp>

auto uri = mongocxx::uri("mongodb://<AWS IAM access key ID>:<AWS IAM secret access key>@<hostname>:<port>/?"
"&authMechanism=MONGODB-AWSS&authMechanismProperties=AWS_SESSION_TOKEN:<token>");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"&authMechanism=MONGODB-AWSS&authMechanismProperties=AWS_SESSION_TOKEN:<token>");
"authMechanism=MONGODB-AWSS&authMechanismProperties=AWS_SESSION_TOKEN:<token>");

#include <mongocxx/uri.hpp>

auto uri = mongocxx::uri("mongodb://mongodbuser%40EXAMPLE.COM@<hostname>:<port>/?"
"&authMechanism=GSSAPI"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"&authMechanism=GSSAPI"
"authMechanism=GSSAPI"

#include <mongocxx/uri.hpp>

auto uri = mongocxx::uri("mongodb://<username>:<password>@<hostname>:<port>/?"
"&authMechanism=PLAIN&tls=true");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"&authMechanism=PLAIN&tls=true");
"authMechanism=PLAIN&tls=true");


.. note::

To authenticate with GSSAPI, you must build the driver with SASL support.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
To authenticate with GSSAPI, you must build the driver with SASL support.
To authenticate with GSSAPI, you must build the C driver with SASL support.

Suggest clarifying the ENABLE_SASL option is intended for the C driver (not C++ driver). The C++ driver wraps the C driver. Auth is performed within the C driver.

@jordan-smith721 jordan-smith721 requested a review from kevinAlbs July 9, 2024 15:02
@kevinAlbs kevinAlbs removed the request for review from kkloberdanz July 9, 2024 20:33
Copy link
Collaborator

@mcmorisi mcmorisi left a comment

Choose a reason for hiding this comment

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

LGTM!

AssumeRoleWithWebIdentity Request
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If your application authenticates users for your EKS cluster from an OpenID Connect (OIDC)
Copy link
Collaborator

Choose a reason for hiding this comment

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

"from" an OIDC identity provider or "with" an OIDC identity provider?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sticking with "from" since this wording is taken from the AWS docs link at the bottom of the section

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If your application authenticates users for your EKS cluster from an OpenID Connect (OIDC)
identity provider, {+driver-short+} can make an ``AssumeRoleWithWebIdentity`` request
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
identity provider, {+driver-short+} can make an ``AssumeRoleWithWebIdentity`` request
identity provider, the {+driver-short+} can make an ``AssumeRoleWithWebIdentity`` request

@jordan-smith721 jordan-smith721 merged commit 71b2761 into mongodb:cpp-standardization Jul 10, 2024
@jordan-smith721 jordan-smith721 deleted the DOCSP-40811-authentication branch July 10, 2024 14:12
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.

4 participants