-
Notifications
You must be signed in to change notification settings - Fork 20
DOCSP-38861 - OIDC #81
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
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.
Nice work on this! A few fixes but otherwise LGTM
source/security/authentication.txt
Outdated
The MONGODB-OIDC authentication mechanism requires MongoDB v7.0 or later running | ||
on a Linux platform. | ||
|
||
{+driver-short+} supports OIDC authentication for *workload identities*. A workload |
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.
{+driver-short+} supports OIDC authentication for *workload identities*. A workload | |
{+driver-short+} supports OIDC authentication for **workload identities**. A workload |
source/security/authentication.txt
Outdated
export AWS_WEB_IDENTITY_TOKEN_FILE=<absolute path to file containing OIDC token> | ||
|
||
Then, define a class that inherits from the ``OIDCCallback`` class. This class must | ||
implement one method, ``fetch()``, that returns the OIDC token in the form of an |
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.
This should also fix the Vale issue
implement one method, ``fetch()``, that returns the OIDC token in the form of an | |
implement a ``fetch()`` method, which returns the OIDC token in the form of an |
source/security/authentication.txt
Outdated
|
||
You can set these options in two ways: by passing arguments to the | ||
``MongoClient`` constructor or through parameters in your connection string. | ||
After you set the preceding environment variable, |
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 think this line was supposed to be deleted?
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. there was so much copy/pasting for this ticket
properties = {"ENVIRONMENT": "azure", "TOKEN_RESOURCE": "<audience>"} | ||
client = MongoClient( | ||
"mongodb://<hostname>:<port>", |
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.
S: Space this out for readability since the example is focused on the client (applies to all code examples)
properties = {"ENVIRONMENT": "azure", "TOKEN_RESOURCE": "<audience>"} | |
client = MongoClient( | |
"mongodb://<hostname>:<port>", | |
properties = {"ENVIRONMENT": "azure", "TOKEN_RESOURCE": "<audience>"} | |
client = MongoClient( | |
"mongodb://<hostname>:<port>", |
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 highlighting
source/security/authentication.txt
Outdated
python3 -m pip install azure-identity | ||
|
||
Next, define a class that inherits from the ``OIDCCallback`` class. This class must | ||
implement one method, ``fetch()``, that returns the OIDC token in the form of an |
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.
implement one method, ``fetch()``, that returns the OIDC token in the form of an | |
implement a ``fetch()`` method, which returns the OIDC token in the form of an |
source/security/authentication.txt
Outdated
you can read the OIDC token from the standard service-account token-file location. | ||
|
||
First, define a class that inherits from the ``OIDCCallback`` class. This class must | ||
implement one method, ``fetch()``, that returns the OIDC token in the form of an |
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.
implement one method, ``fetch()``, that returns the OIDC token in the form of an | |
implement a ``fetch()`` method, which returns the OIDC token in the form of an |
properties = {"OIDC_CALLBACK": MyCallback()} | ||
uri = ("mongodb://<hostname>:<port>/?" | ||
"&authMechanism=MONGODB-OIDC" | ||
"&authMechanismProperties=properties") |
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 you pass properties in the connection string this way?
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.
No, you cannot pass the callback in the connection string
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!
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-38861
Staging - https://preview-mongodbmongokart.gatsbyjs.io/pymongo/docsp-38861-oidc/security/authentication/
Self-Review Checklist