Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
1.1.1
-
None
-
None
-
None
-
Fedora 16
[root@CouchDBTest ~]# uname -a
Linux CouchDBTest 3.3.0-8.fc16.x86_64 #1 SMP Thu Mar 29 18:37:19 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
-
Dont Know
Description
Hello
I'm playing with couchdb and having a small problem with authentication (I would like to be cookie+https only)
With require_valid_user, every action must be authenticated.
Then we need to authenticate to couchdb in order to POST to /_session.
So, if you disable classical HTTP auth, you can't authenticate users on couchdb only with cookie.
[root@CouchDBTest ~]# curl -vX POST http://localhost:5984/_session -H 'Content-Type: application/x-www-form-urlencoded' -d 'name=admin&password=this_is_a_test'
- About to connect() to localhost port 5984 (#0)
- Trying ::1... Connection refused
- Trying 127.0.0.1... connected
- Connected to localhost (127.0.0.1) port 5984 (#0)
> POST /_session HTTP/1.1
> User-Agent: curl/7.21.7 (x86_64-redhat-linux-gnu) libcurl/7.21.7 NSS/3.13.3.0 zlib/1.2.5 libidn/1.22 libssh2/1.2.7
> Host: localhost:5984
> Accept: /
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 34
>
< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: Basic realm="administrator"
< Server: CouchDB/1.1.1 (Erlang OTP/R14B04)
< Date: Sun, 01 Apr 2012 14:58:13 GMT
< Content-Type: text/plain;charset=utf-8
< Content-Length: 61
< Cache-Control: must-revalidate
< {"error":"unauthorized","reason":"Authentication required."} - Connection #0 to host localhost left intact
- Closing connection #0
The workaround to obtain a cookie with require_valid_user=true is to authenticate with classical HTTP auth then to auth again with a POST on _session.
Not POST /_session should be allowed even for require_valid_user=true ?
Thank in advance