-
Notifications
You must be signed in to change notification settings - Fork 14
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
DOCSP-40811 Authentication Mechanisms #22
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.
Good stuff! A smattering of nitpicks, but LGTM otherwise!
- ``username``: The AWS IAM access key ID to authenticate. | ||
- ``password``: The AWS IAM secret access key. | ||
- ``authMechanism``: Set to ``"MONGODB-AWS"``. |
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.
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?
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.
Yep, exactly
You must replace the ``@`` symbol in the URI string with ``%40``, as shown | ||
in the preceding example. |
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.
Looks like there are two @ symbols, only one of which gets encoded to %40. This might make it more clear.
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. |
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.
I reworded to refer to the principal instead of the URI, which I think is more accurate
|
||
1. Named parameters passed to the Connection URI | ||
#. Environment variables | ||
#. ECS container metadata |
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.
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.
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.
Added a section on AssumeRoleWithWebIdentity
source/includes/authentication.cpp
Outdated
auto uri = mongocxx::uri("mongodb://<AWS IAM access key ID>:<AWS IAM secret access key>@<hostname>:<port>/?" | ||
"&authMechanism=MONGODB-AWS"); |
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.
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
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.
Good catch, thanks!
source/includes/authentication.cpp
Outdated
#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>"); |
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.
"&authMechanism=MONGODB-AWSS&authMechanismProperties=AWS_SESSION_TOKEN:<token>"); | |
"authMechanism=MONGODB-AWSS&authMechanismProperties=AWS_SESSION_TOKEN:<token>"); |
source/includes/authentication.cpp
Outdated
#include <mongocxx/uri.hpp> | ||
|
||
auto uri = mongocxx::uri("mongodb://mongodbuser%40EXAMPLE.COM@<hostname>:<port>/?" | ||
"&authMechanism=GSSAPI" |
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.
"&authMechanism=GSSAPI" | |
"authMechanism=GSSAPI" |
source/includes/authentication.cpp
Outdated
#include <mongocxx/uri.hpp> | ||
|
||
auto uri = mongocxx::uri("mongodb://<username>:<password>@<hostname>:<port>/?" | ||
"&authMechanism=PLAIN&tls=true"); |
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.
"&authMechanism=PLAIN&tls=true"); | |
"authMechanism=PLAIN&tls=true"); |
|
||
.. note:: | ||
|
||
To authenticate with GSSAPI, you must build the driver with SASL support. |
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.
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.
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.
LGTM!
AssumeRoleWithWebIdentity Request | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
If your application authenticates users for your EKS cluster from an OpenID Connect (OIDC) |
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.
"from" an OIDC identity provider or "with" an OIDC identity provider?
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.
Sticking with "from" since this wording is taken from the AWS docs link at the bottom of the section
source/security/authentication.txt
Outdated
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
If your application authenticates users for your EKS cluster from an OpenID Connect (OIDC) | ||
identity provider, {+driver-short+} can make an ``AssumeRoleWithWebIdentity`` request |
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.
identity provider, {+driver-short+} can make an ``AssumeRoleWithWebIdentity`` request | |
identity provider, the {+driver-short+} can make an ``AssumeRoleWithWebIdentity`` request |
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-40811
Staging -
https://preview-mongodbjordansmith721.gatsbyjs.io/cpp-driver/DOCSP-40811-authentication/security/authentication/
https://preview-mongodbjordansmith721.gatsbyjs.io/cpp-driver/DOCSP-40811-authentication/security/enterprise-authentication/
Self-Review Checklist