Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-chttpd/pull/53#discussion_r36029319
--- Diff: src/chttpd_auth.erl ---
@@ -12,15 +12,70 @@
-module(chttpd_auth).
+-export([authenticate/2]).
+-export([authorize/2]).
+
-export([default_authentication_handler/1]).
-export([cookie_authentication_handler/1]).
+-export([local_admin_handler/1]).
+
-export([handle_session_req/1]).
+-include_lib("couch/include/couch_db.hrl").
+
+-define(SERVICE_ID, chttpd_auth).
+
+
+%% ------------------------------------------------------------------
+%% API Function Definitions
+%% ------------------------------------------------------------------
+
+authenticate(HttpReq, Default) ->
+ maybe_handle(authenticate, [HttpReq], Default).
+
+authorize(HttpReq, Default) ->
+ maybe_handle(authorize, [HttpReq], Default).
+
+
+%% ------------------------------------------------------------------
+%% Default callbacks
+%% ------------------------------------------------------------------
+
default_authentication_handler(Req) ->
couch_httpd_auth:default_authentication_handler(Req,
chttpd_auth_cache).
cookie_authentication_handler(Req) ->
couch_httpd_auth:cookie_authentication_handler(Req, chttpd_auth_cache).
+local_admin_handler(Req) ->
+ case config:get("chttpd", "require_valid_user", "false") of
--- End diff --
So, since you touched this line, bikeshedding question: we have same option
defined in "couch_http_auth"
[\[1\]](https://github.com/apache/couchdb-couch/blob/master/src/couch_httpd_auth.erl#L106)
[\[2\]](https://github.com/apache/couchdb-couch/blob/master/src/couch_httpd.erl#L409)
section. Shouldn't it be used here as well to avoid having same things
duplicated?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---