joelittlejohn / embedmongo-maven-plugin

Maven plugin wrapper for the flapdoodle.de embedded MongoDB API
Apache License 2.0
88 stars 51 forks source link

Enable authentication for Mongo #25

Closed chapmbk closed 11 years ago

chapmbk commented 11 years ago

We have tests that require Mongo authentication to be turned on. This is not possible with the current plugin. I have already added support to my local copy and can send a patch if needed.

            if (authEnabled) {
                commandLinePostProcessor = new ICommandLinePostProcessor() {
                    @Override
                    public List<String> process(
                            final Distribution distribution, final List<String> args) {
                        args.remove("--noauth");
                        args.add("--auth");
                        return args;
                    }
                };
            }
joelittlejohn commented 11 years ago

Thanks, this looks like a nice addition. I'll add it in the next version.

Incidentally, how are you adding users to the embedded db once it starts?

chapmbk commented 11 years ago

We are adding them as part of the test suite set up using the Mongo client(MongoClient.getDb().addUser()). I added that step as part of the plugin initially, but after thinking about it, I thought it fit better as test set up.

chapmbk commented 11 years ago

I sent you a pull request for this one so you could see the change.