Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[fix] stdlib: Update auth params in low-level data structure for exte…

…rnal authentication routine.
  • Loading branch information...
commit 324d80b3a655a5c1ce5af05bc50eecd27f463b5a 1 parent 5c991f1
@nrs135 nrs135 authored
Showing with 11 additions and 5 deletions.
  1. +6 −0 CHANGELOG
  2. +5 −5 stdlib/apis/mongo/connection.opa
View
6 CHANGELOG
@@ -6,6 +6,12 @@ Updated APIs:
- changed the import names
- added Font Awesome icons
+ * Mongo low-level drivers
+ - added authentication parameters and command line options
+
+Other features:
+
+ * Added authentication options for @mongo database
2012.03.09, Version 0.9.1 (stable), v1466
View
10 stdlib/apis/mongo/connection.opa
@@ -279,19 +279,19 @@ MongoConnection = {{
* Perform authentication on a connection.
* Normally handled automatically from command line options or built-in parameters but
* you can perform authentications from other sources, here.
- * Caveat: you will need to re-authenticate manually after each reconnection on a replica set.
- * How you'll do this, I don't know but you'll probably need to pick up on the "db unauthorized"
- * messages after the reconnect.
**/
authenticate(db:Mongo.mongodb, auth:Mongo.auths) =
List.fold((auth, outcome ->
match outcome with
- | {success=_} ->
+ | {success=db} ->
match MongoCommands.authenticate(db, auth.dbname, auth.user, auth.password) with
| {success=_} ->
do if db.mongo.log
then ML.info("MongoConnection.authenticate","success",void)
- outcome
+ {success={db with mongo={db.mongo with
+ auth=[{dbname=auth.dbname;
+ user=auth.user;
+ password=auth.password}|db.mongo.auth]}}}
| {~failure} ->
do if db.mongo.log
then ML.info("MongoConnection.authenticate","failure {failure}",void)
Please sign in to comment.
Something went wrong with that request. Please try again.