authentication problem

15 views
Skip to first unread message

Roland Bole

unread,
Jun 18, 2015, 11:15:02 AM6/18/15
to node-mong...@googlegroups.com
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;
 
}



Message has been deleted

chris

unread,
Jun 19, 2015, 6:34:23 PM6/19/15
to node-mong...@googlegroups.com
Roland,  

I ran into this as well with giving the wrong password.  It actually does use the password.  However, like you pointed out it is returning true in the scenario that it is the wrong password.  I found that scram.js has a bug in the handle error function.

I modified my local copy with the line in blue.  Hopefully, this will get updated.  Hope this

Roland Bole

unread,
Jun 20, 2015, 10:42:08 AM6/20/15
to node-mong...@googlegroups.com
Hi Chris,
thanks for the hint, but where can I find this code snipped ??
I use the following npm package: "mongodb": "^2.0.34"

Reply all
Reply to author
Forward
0 new messages