[SERVER-25735] connectionStatus only returns info for most recently auth'd user Created: 22/Aug/16  Updated: 23/Aug/16  Resolved: 23/Aug/16

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 3.2.7
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Allison Reinheimer Moore Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to DOCS-7631 Document the showPrivileges option to... Closed
Operating System: ALL
Steps To Reproduce:

> db.createUser({user:"example",pwd:"abc123",roles:[{role:"readWrite",db:"example"}]})
Successfully added user: {
	"user" : "example",
	"roles" : [
		{
			"role" : "readWrite",
			"db" : "example"
		}
	]
}
> db.createUser({user:"folklore",pwd:"abc123",roles:[{role:"readWrite",db:"folklore"}]})
Successfully added user: {
	"user" : "folklore",
	"roles" : [
		{
			"role" : "readWrite",
			"db" : "folklore"
		}
	]
}
> db.auth("example","abc123")
1
> db.runCommand({connectionStatus:1})
{
	"authInfo" : {
		"authenticatedUsers" : [
			{
				"user" : "example",
				"db" : "admin"
			}
		],
		"authenticatedUserRoles" : [
			{
				"role" : "readWrite",
				"db" : "example"
			}
		]
	},
	"ok" : 1
}
> db.auth("folklore","abc123")
1
> db.runCommand({connectionStatus:1})
{
	"authInfo" : {
		"authenticatedUsers" : [
			{
				"user" : "folklore",
				"db" : "admin"
			}
		],
		"authenticatedUserRoles" : [
			{
				"role" : "readWrite",
				"db" : "folklore"
			}
		]
	},
	"ok" : 1
}
> db.auth('admin','admin')
1
> db.runCommand({connectionStatus:1})
{
	"authInfo" : {
		"authenticatedUsers" : [
			{
				"user" : "admin",
				"db" : "admin"
			}
		],
		"authenticatedUserRoles" : [
			{
				"role" : "root",
				"db" : "admin"
			}
		]
	},
	"ok" : 1
}

Participants:

 Description   

From my understanding of how the connectionStatus command is supposed to work (based on the help text in the command, and discussion with kyle.suarez), it should return info on all auth'd users on the given connection. However, when I've attempted to make it do so, it seems to only return info for the user who most recently authenticated.

I've plopped my shell copypasta into the Steps to Repro. I'm on 3.2.7.



 Comments   
Comment by Allison Reinheimer Moore [ 23/Aug/16 ]

Darnit. Thanks schwerin - that does indeed clear it up! Closing accordingly (and with appropriate shame).

Comment by Andy Schwerin [ 22/Aug/16 ]

You may only be authenticated as one user per database at a time. I.e., one user on the admin database, one on local, one on foo, etc. Try that?

Generated at Thu Feb 08 04:10:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.