Skip to content

Conversation

blink1073
Copy link
Member

GODRIVER-3215

Summary

  • Move logic for creating an authenticator from ClientOptions to a new function topology.NewAuthenticator. Use it everywhere that needs to create an authenticator from ClientOptions.
    • Requires moving convertOIDCArgs into the topology package.
  • Move the logic for setting the default auth source into each individual authenticator type.
    • The current logic for setting the default auth source appears to be in topology.NewConfigWithAuthenticator, but actually has no effect currently, so no default auth sources are being set.
  • Update PLAIN authenticator to support auth sources other than "$external".
    • Using the database name from the connection string as the auth source is currently supported in connstring, but is ignored by the PLAIN authenticator. Using database name from the connection string is also described in the spec.
  • Correct MONGODB-OIDC connection string logic for setting auth source (it should be identical to MONGODB-AWS and MONGODB-X509).

Background & Motivation

Currently, if auth mechanism "MONGODB-AWS" is set using ClientOptions.SetAuth, the default auth source is set to "admin" instead of "$external". The result is a confusing error message

MONGODB-AWS source must be empty or $external

There was a further regression (that hasn't been released yet) caused by #1678, which effectively skips all of the default auth source logic. Refactor the authenticator creation logic and the default auth source logic to make similar regressions more obvious.

matthewdale and others added 2 commits September 10, 2024 10:08
…tions. (mongodb#1764)

Co-authored-by: Preston Vasquez <[email protected]>
Co-authored-by: Steven Silvester <[email protected]>
(cherry picked from commit 18d1b19)
@blink1073 blink1073 added the review-priority-urgent High Priority PR for Review: review immediately! label Sep 10, 2024
Copy link
Contributor

API Change Report

./v2/mongo/options

incompatible changes

BSONOptions.ObjectIDAsHexString: removed

./v2/x/mongo/driver

incompatible changes

##CursorOptions.MarshalValueEncoderFn: changed from func(io.Writer) ./v2/bson.Encoder to func(io.Writer) (./v2/bson.Encoder, error)

./v2/x/mongo/driver/topology

compatible changes

ConvertCreds: added

@blink1073 blink1073 merged commit 9e7ccb0 into mongodb:master Sep 10, 2024
30 of 33 checks passed
@blink1073 blink1073 deleted the GODRIVER-3333-master branch September 10, 2024 18:05
@blink1073 blink1073 changed the title GODRIVER-3215 Fix default auth source for auth specified via ClientOptions [master] GODRIVER-3333 Fix default auth source for auth specified via ClientOptions [master] Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-priority-urgent High Priority PR for Review: review immediately!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants