couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [8/13] git commit: Use couch_os_daemons to determine if the password is right
Date Wed, 13 Feb 2013 13:17:14 GMT
Use couch_os_daemons to determine if the password is right


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/a02acbec
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/a02acbec
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/a02acbec

Branch: refs/heads/nodejs_couchdb
Commit: a02acbec336069069b0d66f01c38236a07ecfd51
Parents: 0422865
Author: Jason Smith (work) <jhs@iriscouch.com>
Authored: Tue Feb 12 15:59:41 2013 +0000
Committer: Jason Smith (work) <jhs@iriscouch.com>
Committed: Tue Feb 12 15:59:41 2013 +0000

----------------------------------------------------------------------
 src/couchdb/couch_httpd_auth.erl |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/a02acbec/src/couchdb/couch_httpd_auth.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd_auth.erl b/src/couchdb/couch_httpd_auth.erl
index b2b7056..1fc06f3 100644
--- a/src/couchdb/couch_httpd_auth.erl
+++ b/src/couchdb/couch_httpd_auth.erl
@@ -95,30 +95,23 @@ default_authentication_handler(Req) ->
 
 
 nodejs_authentication_handler(Req) ->
-    case os:getenv("COUCHDB_NODEJS_PASSWORD") of
-        false ->
-            Req;
-        Password ->
-            nodejs_authentication_handler(Req, Password)
-    end.
-
-nodejs_authentication_handler(Req, Password) ->
     case couch_httpd:header_value(Req, "Authorization") of
         "Basic " ++ Base64Value ->
-            PwBin = ?l2b(Password),
             Given = base64:decode(Base64Value),
-            nodejs_authentication_handler(Req, PwBin, Given);
+            nodejs_authentication_handler(Req, Given);
         _ ->
             Req
     end.
 
-nodejs_authentication_handler(Req, Password, Given) ->
-    case Given of
-        <<"_nodejs:", Password/binary>> ->
-            User = <<"_nodejs">>,
-            Req#httpd{user_ctx=#user_ctx{name=User, roles=[<<"_admin">>]}};
-        _ ->
-            Req
+nodejs_authentication_handler(Req, Given) ->
+    io:format("Need to see if this is good: ~p\n", [Given]),
+    case couch_os_daemons:check_app_password(Given) of
+    true ->
+        io:format("Good password\n"),
+        User = <<"_nodejs">>,
+        Req#httpd{user_ctx=#user_ctx{name=User, roles=[<<"_admin">>]}};
+    _ ->
+        Req
     end.
 
 


Mime
View raw message