Skip to content

Patch/mongo3 authentication#51

Open
jclausen wants to merge 10 commits intomarcesher:masterfrom
jclausen:patch/Mongo3-Authentication
Open

Patch/mongo3 authentication#51
jclausen wants to merge 10 commits intomarcesher:masterfrom
jclausen:patch/Mongo3-Authentication

Conversation

@jclausen
Copy link

@jclausen jclausen commented Nov 2, 2015

This patch addresses Issue #50 and authentication against Mongo 3.0+ databases. It also implements an optional key in the config auth structure for an authenticationDB key in the hosts array as well as credentials. Third party mongo providers, such as MongoLab, use the client db for authentication on low-level plans, while switching to the Mongo default "admin" db on higher level plans.

Implementation example (backward compatibility is maintained):

var javaloaderFactory = createObject('component','cfmongodb.core.JavaloaderFactory').init();
var configStruct.MongoDB = {
    hosts       = [
                     {
                        serverName='ds01234.mongolab.com',
                        serverPort='1234',
                        username="unitTestUser",
                        password="SecurePa55w0rD",
                        authenticationDB="cbmongo_unit_tests"
                     }
                  ],
    db  = "cbmongo_unit_tests"
};
var MongoConfig = createObject('component','cfmongodb.config.MongoConfig').init(hosts=configStruct.MongoDB.hosts,dbName=configStruct.MongoDB.db, mongoFactory=javaloaderFactory);

@marcesher
Copy link
Owner

@jclausen
Thanks for the PR.

I'm not sure what's up with this PR, but MongoClient looks like a completely new file. Please fix the PR so that it reflects only what's actually changing.

When you say backwards compatible, what versions of Mongo and ColdFusion have you tested this against? And do all unit tests continue to work?

Finally, do these changes require additional unit tests, or do the existing tests adequately cover the changes?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants