RUBY-3303 Add OIDC machine workflow auth (WIP) #2873
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for
MONGODB-OIDC
as an authentication mechanism for MongoDB server versions 7.0+. The currently supported facets to authenticate with are custom callback authentication, Azure machine authentication, and GCP machine authentication.Azure Machine Authentication
The
Mongo::Client
must be instantiated withauthMechanism=MONGODB-OIDC
in the URI or in the client options. Additional required auth mechanism properties ofTOKEN_RESOURCE
andENVIRONMENT
are required and another optional username can be provided. Example:GCP Machine Authentication
The
Mongo::Client
must be instantiated withauthMechanism=MONGODB-OIDC
in the URI or in the client options. Additional required auth mechanism properties ofTOKEN_RESOURCE
andENVIRONMENT
are required. Example:Custom Machine Callbacks
Users can provide a custom callback that returns a token from the environment without requiring user interaction. The callback must be passed as an instantiated class that defines one method
execute
that takes 3 named arguments:timeout
,:version
, and:username
and returns a hash of{ access_token: <value> }
. The callback is then provided as an auth mechanism property to the mongo client as:oidc_callback
.Notes
This is a WIP, starting as Skunkworks project and will continue adding to it during the quarter.
Updates:
https://spruce.mongodb.com/version/669aa98654b1ac0007081655/tasks?page=0&sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC&variant=%5Etest-oidc-variant__mongodb-version~latest_topology~standalone_ruby~ruby-3.2_os~ubuntu2204_fle~helper%24