diff options
author | Jason Smith (work) <jhs@iriscouch.com> | 2013-02-12 15:59:41 +0000 |
---|---|---|
committer | Jason Smith (work) <jhs@iriscouch.com> | 2013-02-12 15:59:41 +0000 |
commit | a02acbec336069069b0d66f01c38236a07ecfd51 (patch) | |
tree | b9dd8b2c73ac841adc6874f15e0724d3cad0fea8 | |
parent | 0422865336ce7df2bed46b52d3f01e61a7a014e4 (diff) | |
download | couchdb-a02acbec336069069b0d66f01c38236a07ecfd51.tar.gz |
Use couch_os_daemons to determine if the password is right
-rw-r--r-- | src/couchdb/couch_httpd_auth.erl | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/couchdb/couch_httpd_auth.erl b/src/couchdb/couch_httpd_auth.erl index b2b705608..1fc06f32b 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. |