Skip to content

GODRIVER-3429 Revert internal-only "AuthenticateToAnything". #2025

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

qingyang-hu
Copy link
Collaborator

@qingyang-hu qingyang-hu commented Apr 21, 2025

GODRIVER-3429

Summary

  • Revert internal-only "AuthenticateToAnything"
  • Add test for PerformAuthentication in HandshakeOptions.

Background & Motivation

@mongodb-drivers-pr-bot mongodb-drivers-pr-bot bot added the priority-3-low Low Priority PR for Review label Apr 21, 2025
Copy link
Contributor

mongodb-drivers-pr-bot bot commented Apr 21, 2025

API Change Report

No changes found!

@qingyang-hu qingyang-hu marked this pull request as ready for review May 1, 2025 22:02
@qingyang-hu qingyang-hu requested a review from a team as a code owner May 1, 2025 22:02
@qingyang-hu qingyang-hu requested a review from prestonvasquez May 1, 2025 22:02
@@ -85,6 +90,74 @@ func TestLoadBalancedFromConnString(t *testing.T) {
}
}

type testAuthenticator struct{}
Copy link
Member

Choose a reason for hiding this comment

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

Can add a compile check asserting that this type implements driver.Authenticator?

case "authenticateToAnything":
b, ok := option.(bool)
if !ok {
return fmt.Errorf(typeErr, key)
Copy link
Member

Choose a reason for hiding this comment

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

Can we update these errors to describe the type that we want? Possible using some kind of composing function:

typeErrFuc := func() string {
	return fmt.Sprintf("unexecpted type for %q, wanted %T, got %T", key, option, option)
}

@@ -9,6 +9,7 @@ package xoptions
import (
"fmt"

internalOptions "go.mongodb.org/mongo-driver/v2/internal/options"
Copy link
Member

Choose a reason for hiding this comment

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

Should we rename the internal/options package to internal/optionsutil? That seems to follow the existing pattern. Then we can avoid aliasing imports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-3-low Low Priority PR for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants