EnterpriseDB / mongo_fdw

PostgreSQL foreign data wrapper for MongoDB
GNU Lesser General Public License v3.0
326 stars 70 forks source link

Is there any way to specify the authentication database #51

Closed acheccuc closed 2 years ago

acheccuc commented 8 years ago

In our clusters the authentication database is separated from the database the user create collections in. I have browsed the source code, but haven't found any option to specify both. Could you please suggest any method?

ahsanhadi commented 8 years ago

Can you please clarify your requirement with a test case? Where do you want to specify both databases when you create the foreign table?

acheccuc commented 8 years ago

Hi Ahsan, thanks for looking into that. I would logically keep it with the user mapping, since it's part of the authentication and authorization phase rather than database work.

Just to give you an example, we use this kind of command line with the mongo shell:

mongo --host HOSTNAME --username USER --password PASSWD -- authenticationDatabase admin DATABASE_NAME

What happens is that USER authenticates against the admin database, where a role is applied which grants privileges for that USER on the DATABASE_NAME database.

Thanks Alessio

ahsanhadi commented 8 years ago

Thanks for your response. This is a new feature request. I need to discuss the priority of this with our product management...

acheccuc commented 8 years ago

Checking the opened issues I see that the same request was filed on 12 Mar 2015 as #26. They should probably be merged....

ahsanhadi commented 8 years ago

Agreed...I will go ahead and update #26....

Unfortunately this is still not prioritised due to resource constraint but it is still on the radar...

rotten commented 8 years ago

I think it would be great if we could just pass a mongodb url:

https://docs.mongodb.com/manual/reference/connection-string/

Then we can connect to a replica set, use ssl, use an authentication database, and configure other tunables as they come up or get dropped by the MongoDB development team without having to deal with a significant recoding effort on the FDW to support one connection feature or another.

Not being able to use an alternate authentication database is a show stopper for us using this FDW.

acheccuc commented 7 years ago

I have tried to install the latest version, given that issue #26 has been marked as Closed with the following comment:

"In Meta driver the connection string "URI" already has database option, so it should work."

I don't see how to specify a MongoDB URI to connect, according to the docs included with the FDW. Could you please help or give me any clue whether this issue has been tackled?

petroswork commented 7 years ago

https://github.com/EnterpriseDB/mongo_fdw/issues/77 works for me, thanks.