Skip to content

Commit

Permalink
GODRIVER-846 change AuthenticateArbiter to AuthenticateToAnything
Browse files Browse the repository at this point in the history
Change-Id: I555b14556e8f0471ef3dec283f5a26961ac351d1
  • Loading branch information
Isabella Siu committed Feb 21, 2019
1 parent bda3cf7 commit a1dceec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
8 changes: 2 additions & 6 deletions mongo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,10 @@ func (c *Client) configure(opts *options.ClientOptions) error {
// Required for SASL mechanism negotiation during handshake
handshakeOpts.DBUser = cred.Source + "." + cred.Username
}
if opts.AuthenticateArbiter != nil && *opts.AuthenticateArbiter {
if opts.AuthenticateToAnything != nil && *opts.AuthenticateToAnything {
// Authenticate arbiters
handshakeOpts.PerformAuthentication = func(serv description.Server) bool {
return serv.Kind == description.RSPrimary ||
serv.Kind == description.RSSecondary ||
serv.Kind == description.Mongos ||
serv.Kind == description.Standalone ||
serv.Kind == description.RSArbiter
return true
}
}

Expand Down
16 changes: 6 additions & 10 deletions mongo/options/clientoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ type Credential struct {
type ClientOptions struct {
AppName *string
Auth *Credential
AuthenticateArbiter *bool
ConnectTimeout *time.Duration
Compressors []string
Dialer ContextDialer
Expand All @@ -84,6 +83,10 @@ type ClientOptions struct {
ZlibLevel *int

err error

// Adds an option for internal use only and should not be set. This option is deprecated and is
// not part of the stability guarantee. It may be removed in the future.
AuthenticateToAnything *bool
}

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

// SetAuthenticateArbiter specifies whether or not the driver should authenticate arbiters. By
// default, they are not authenticated.
func (c *ClientOptions) SetAuthenticateArbiter(b bool) *ClientOptions {
c.AuthenticateArbiter = &b
return c
}

// SetConnectTimeout specifies the timeout for an initial connection to a server.
// If a custom Dialer is used, this method won't be set and the user is
// responsible for setting the ConnectTimeout for connections on the dialer
Expand Down Expand Up @@ -443,8 +439,8 @@ func MergeClientOptions(opts ...*ClientOptions) *ClientOptions {
if opt.Auth != nil {
c.Auth = opt.Auth
}
if opt.AuthenticateArbiter != nil {
c.AuthenticateArbiter = opt.AuthenticateArbiter
if opt.AuthenticateToAnything != nil {
c.AuthenticateToAnything = opt.AuthenticateToAnything
}
if opt.Compressors != nil {
c.Compressors = opt.Compressors
Expand Down

0 comments on commit a1dceec

Please sign in to comment.