Skip to content

Commit a1dceec

Browse files
author
Isabella Siu
committed
GODRIVER-846 change AuthenticateArbiter to AuthenticateToAnything
Change-Id: I555b14556e8f0471ef3dec283f5a26961ac351d1
1 parent bda3cf7 commit a1dceec

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

mongo/client.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,10 @@ func (c *Client) configure(opts *options.ClientOptions) error {
277277
// Required for SASL mechanism negotiation during handshake
278278
handshakeOpts.DBUser = cred.Source + "." + cred.Username
279279
}
280-
if opts.AuthenticateArbiter != nil && *opts.AuthenticateArbiter {
280+
if opts.AuthenticateToAnything != nil && *opts.AuthenticateToAnything {
281281
// Authenticate arbiters
282282
handshakeOpts.PerformAuthentication = func(serv description.Server) bool {
283-
return serv.Kind == description.RSPrimary ||
284-
serv.Kind == description.RSSecondary ||
285-
serv.Kind == description.Mongos ||
286-
serv.Kind == description.Standalone ||
287-
serv.Kind == description.RSArbiter
283+
return true
288284
}
289285
}
290286

mongo/options/clientoptions.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ type Credential struct {
6161
type ClientOptions struct {
6262
AppName *string
6363
Auth *Credential
64-
AuthenticateArbiter *bool
6564
ConnectTimeout *time.Duration
6665
Compressors []string
6766
Dialer ContextDialer
@@ -84,6 +83,10 @@ type ClientOptions struct {
8483
ZlibLevel *int
8584

8685
err error
86+
87+
// Adds an option for internal use only and should not be set. This option is deprecated and is
88+
// not part of the stability guarantee. It may be removed in the future.
89+
AuthenticateToAnything *bool
8790
}
8891

8992
// Client creates a new ClientOptions instance.
@@ -288,13 +291,6 @@ func (c *ClientOptions) SetCompressors(comps []string) *ClientOptions {
288291
return c
289292
}
290293

291-
// SetAuthenticateArbiter specifies whether or not the driver should authenticate arbiters. By
292-
// default, they are not authenticated.
293-
func (c *ClientOptions) SetAuthenticateArbiter(b bool) *ClientOptions {
294-
c.AuthenticateArbiter = &b
295-
return c
296-
}
297-
298294
// SetConnectTimeout specifies the timeout for an initial connection to a server.
299295
// If a custom Dialer is used, this method won't be set and the user is
300296
// responsible for setting the ConnectTimeout for connections on the dialer
@@ -443,8 +439,8 @@ func MergeClientOptions(opts ...*ClientOptions) *ClientOptions {
443439
if opt.Auth != nil {
444440
c.Auth = opt.Auth
445441
}
446-
if opt.AuthenticateArbiter != nil {
447-
c.AuthenticateArbiter = opt.AuthenticateArbiter
442+
if opt.AuthenticateToAnything != nil {
443+
c.AuthenticateToAnything = opt.AuthenticateToAnything
448444
}
449445
if opt.Compressors != nil {
450446
c.Compressors = opt.Compressors

0 commit comments

Comments
 (0)