monger.core/authenticate should not require a connection
This commit is contained in:
parent
b0cd0bf671
commit
e04c694e3c
1 changed files with 2 additions and 2 deletions
|
|
@ -148,7 +148,7 @@
|
||||||
|
|
||||||
|
|
||||||
(defn authenticate
|
(defn authenticate
|
||||||
([^MongoClient connection ^DB db ^String username ^chars password]
|
([^DB db ^String username ^chars password]
|
||||||
(try
|
(try
|
||||||
(.authenticate db username password)
|
(.authenticate db username password)
|
||||||
;; MongoDB Java driver's exception hierarchy is a little crazy
|
;; MongoDB Java driver's exception hierarchy is a little crazy
|
||||||
|
|
@ -167,7 +167,7 @@
|
||||||
user (.getUsername uri)
|
user (.getUsername uri)
|
||||||
pwd (.getPassword uri)]
|
pwd (.getPassword uri)]
|
||||||
(when (and user pwd)
|
(when (and user pwd)
|
||||||
(when-not (authenticate conn db user pwd)
|
(when-not (authenticate db user pwd)
|
||||||
(throw (IllegalArgumentException. (format "Could not authenticate with MongoDB. Either database name or credentials are invalid. Database name: %s, username: %s" (.getName db) user)))))
|
(throw (IllegalArgumentException. (format "Could not authenticate with MongoDB. Either database name or credentials are invalid. Database name: %s, username: %s" (.getName db) user)))))
|
||||||
{:conn conn :db db}))
|
{:conn conn :db db}))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue