[GODRIVER-921] with database specified in URI, driver should not neccessarily attempt to authenticate Created: 01/Apr/19  Updated: 27/Oct/23  Resolved: 04/Apr/19

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Sam Kleinman (Inactive) Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates GODRIVER-920 Specifying a database name in URI oth... Closed
Related

 Description   

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



 Comments   
Comment by Ian Whalen (Inactive) [ 04/Apr/19 ]

This will be addressed in GODRIVER-870.

Generated at Thu Feb 08 08:35:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.