hi i have to following situation:
I try to authenticate one user against a given database. So if I try to change the database on the server and try to authenticate, the password will not be used from the driver in this situation !! If I try it on mongo shell the authentication works as expected.
The authentication works but it doesn't use the password. The authentication is always true, also if the password is wrong. The only point, where the authentication method gives an error back, is in the case, if the password is empty!
So the question is, why the password isn't use ????
changeDb: function(dbname){
var deferred = q.defer();
var test = require('assert');
db.DbServer = db.DbServer.db(dbname);
if(dbname in db.Conns){
console.log("DB "+dbname+ " vorhanden !");
deferred.resolve(true);
} else {
console.log(db.Config[dbname].user+" "+db.Config[dbname].pwd);
db.DbServer.authenticate(db.Config[dbname].user, db.Config[dbname].pwd, function(err, result) {
if(err){console.log(err);}
console.log(result);
test.equal(true, result, "Authentication wrong");
if(result){
console.log("authenticate for DB "+dbname+" ready "+db.Config[dbname].pwd);
db.Conns['co_1']=db.DbServer;
deferred.resolve(result);
} else {
console.log("authenticate for DB "+dbname+" wrong");
deferred.resolve(result);
}});
}
return deferred.promise;
}