You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/11/02 17:40:18 UTC

[GitHub] wohali commented on issue #1711: cookie_authentication_handler failing to achieve successful cookie auth due to aggressive default timeout

wohali commented on issue #1711: cookie_authentication_handler failing to achieve successful cookie auth due to aggressive default timeout
URL: https://github.com/apache/couchdb/issues/1711#issuecomment-435455787
 
 
   @kennsippell I think you left the `;` at the end of your cookie, try taking that off?
   
   Can you include a full example of the commands you're using? I'm unable to reproduce - here's my worked example following along with [our documentation](http://docs.couchdb.org/en/stable/intro/security.html#cookie-authentication):
   
   ```bash
   $ curl localhost:15984/
   {"couchdb":"Welcome","version":"2.2.0-f350d5f5d","git_sha":"f350d5f5d","features":["pluggable-storage-engines","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}
   $ curl localhost:15984/_users
   {"db_name":"_users","purge_seq":"0-g1AAAAFDeJzLYWBg4MhgTmHgz8tPSTV0MDQy1zMAQsMcoARTHguQZGgAUv___5-flciAU2WSApBMsgcqw6cKYt4DiHl4VSYlgMyrJ8q8AxDz7hNWuQCicj9emx1ANscTsDmRIUkeoiQLAMIZVnY","update_seq":"1-g1AAAAFDeJzLYWBg4MhgTmHgz8tPSTV0MDQy1zMAQsMcoARTIkOS_P___7MSGXAqSVIAkkn2hFQ5gFTFg1Ux4laVAFJVT8CsPBYgydAApIAK5xNWuQCicj9hlQcgKu8TVvkAohLkziwAHyFWdw","sizes":{"file":38110,"external":5361,"active":2322},"other":{"data_size":5361},"doc_del_count":0,"doc_count":1,"disk_size":38110,"disk_format_version":7,"data_size":2322,"compact_running":false,"cluster":{"q":8,"n":1,"w":1,"r":1},"instance_start_time":"0"}
   $ curl -X PUT localhost:15984/_users/org.couchdb.user:wohali \
   >   -H "Accept: application/json" \
   >   -H "Content-Type: application/json" \
   >   -d '{"name": "wohali", "password": "apple", "roles": [], "type": "user"}'
   {"ok":true,"id":"org.couchdb.user:wohali","rev":"1-eeaf91cbeec553b1bb511be8e209bfda"}
   $ curl -vX POST localhost:15984/_session   -H "Content-Type: application/x-www-form-urlencoded"   -d "name=wohali&password=apple"
   Note: Unnecessary use of -X or --request, POST is already inferred.
   *   Trying ::1...
   * TCP_NODELAY set
   * connect to ::1 port 15984 failed: Connection refused
   *   Trying 127.0.0.1...
   * TCP_NODELAY set
   * Connected to localhost (127.0.0.1) port 15984 (#0)
   > POST /_session HTTP/1.1
   > Host: localhost:15984
   > User-Agent: curl/7.52.1
   > Accept: */*
   > Content-Type: application/x-www-form-urlencoded
   > Content-Length: 26
   >
   * upload completely sent off: 26 out of 26 bytes
   < HTTP/1.1 200 OK
   < Cache-Control: must-revalidate
   < Content-Length: 39
   < Content-Type: application/json
   < Date: Fri, 02 Nov 2018 17:37:35 GMT
   < Server: CouchDB/2.2.0-f350d5f5d (Erlang OTP/19)
   < Set-Cookie: AuthSession=d29oYWxpOjVCREM4QjVGOt5WmL3C4JxHbMDbyBtF6zLDQhnJ; Version=1; Path=/; HttpOnly
   <
   {"ok":true,"name":"wohali","roles":[]}
   * Curl_http_done: called premature == 0
   * Connection #0 to host localhost left intact
   $ curl -vX PUT localhost:15984/mydatabase \
   >   --cookie AuthSession=d29oYWxpOjVCREM4QjVGOt5WmL3C4JxHbMDbyBtF6zLDQhnJ \
   >   -H "X-CouchDB-WWW-Authenticate: Cookie" \
   >   -H "Content-Type:application/x-www-form-urlencoded"
   *   Trying ::1...
   * TCP_NODELAY set
   * connect to ::1 port 15984 failed: Connection refused
   *   Trying 127.0.0.1...
   * TCP_NODELAY set
   * Connected to localhost (127.0.0.1) port 15984 (#0)
   > PUT /mydatabase HTTP/1.1
   > Host: localhost:15984
   > User-Agent: curl/7.52.1
   > Accept: */*
   > Cookie: AuthSession=d29oYWxpOjVCREM4QjVGOt5WmL3C4JxHbMDbyBtF6zLDQhnJ
   > X-CouchDB-WWW-Authenticate: Cookie
   > Content-Type:application/x-www-form-urlencoded
   >
   < HTTP/1.1 401 Unauthorized
   < Cache-Control: must-revalidate
   < Content-Length: 64
   < Content-Type: application/json
   < Date: Fri, 02 Nov 2018 17:38:55 GMT
   < Server: CouchDB/2.2.0-f350d5f5d (Erlang OTP/19)
   < Set-Cookie: AuthSession=d29oYWxpOjVCREM4QkIwOsxazK0odiw0o-B2dPfhC8wrdxQS; Version=1; Path=/; HttpOnly
   < WWW-Authenticate: Cookie
   < X-Couch-Request-ID: 2b2016a76b
   < X-CouchDB-Body-Time: 0
   <
   {"error":"unauthorized","reason":"You are not a server admin."}
   * Curl_http_done: called premature == 0
   * Connection #0 to host localhost left intact
   ```
   
   OK, so I tried something for which I'm not authorized, but it did work.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services