with database specified in URI, driver should not neccessarily attempt to authenticate

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      package mongo
      
      import (
      	"testing"
      
      	"github.com/stretchr/testify/require"
      	"go.mongodb.org/mongo-driver/mongo/options"
      )
      
      func TestURIParsingAuth(t *testing.T) {
      	opts := options.Client().ApplyURI("mongodb://localhost:27017")
      	require.Nil(t, opts.Auth)
      
      	opts = options.Client().ApplyURI("mongodb://localhost:27017/test")
      	require.Nil(t, opts.Auth)
      }
      

      the second assertion fails.

      I believe the bug is fixed by removing the final conditional (cs.AuthSource != "admin") from line 126 of go.mongodb.org/mongo-driver/mongo/options/clientoptions.go

              Assignee:
              Unassigned
              Reporter:
              Sam Kleinman (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: