问题描述
我越来越设置使用CouchDB的Cloudant,我很困惑,因为Cloudant似乎比普通的CouchDB做AUTH不同。具体来说,Cloudant似乎缺少一个 _users
数据库。
I'm getting set up with CouchDB on Cloudant, and I'm confused because Cloudant seems to do auth differently than regular CouchDB. Specifically, Cloudant seems to lack a _users
database.
我读了Cloudant AUTH常见问题解答,它提供了以下说明:
I read the Cloudant auth FAQ here, and it provided the following instructions:
我可以使用CouchDB的安全功能(_users数据库,安全性
在Cloudant对象,验证功能)?
当然可以。如果你想
使用_users数据库,则必须先关闭Cloudant自己
安全要通过_users管理的角色。要做到这一点,你
需要把JSON文档类似下面的_security
数据库的端点(例如
https://USERNAME.cloudant.com/DATABASE/_security):
Yes you can. If you want to use the _users database you must first turn off Cloudant's own security for the roles you want to manage via _users. To do this you need to PUT a JSON document like the following to the _security endpoint of the database (for example https://USERNAME.cloudant.com/DATABASE/_security):
{cloudant:{
没有人:_reader,_writer,_admin]},读者:{
名字:演示],角色:[]}}
{ "cloudant": { "nobody": ["_reader", "_writer", "_admin"] }, "readers": { "names":["demo"],"roles":[] } }
这些指令工作的罚款,并允许我来更新数据库的_security对象。
These instructions worked fine, and allowed me to update the _security object of a database.
什么是不明确的是如何建立_users数据库。它没有自动存在,所以我尝试使用它创建一个常规的:
What wasn't clear was how to set up the _users database. It didn't exist automatically, so I tried creating it using a regular:
卷曲-X PUT $ COUCH / _users
这工作得很好,但是当我尝试一个新的用户添加到_users如下:
This worked fine, but when I attempt to add a new user to _users as follows:
curl -HContent-Type:application/json \
-vXPUT $COUCH/_users/org.couchdb.user:me \
--data-binary '{"_id": "org.couchdb.user:me","name": "me","roles": [],"type": "user","password": "pwd"}'
这似乎正确地创建文档:
It appears to create the document correctly:
<$c$c>{\"ok\":true,\"id\":\"org.couchdb.user:me\",\"rev\":\"3-86c3801fdb8c32331f5f2580e861a765\"}$c$c>
但在Cloudant _users新用户缺少一个哈希密码:
But the new user in _users on Cloudant lacks a hashed password:
{
"_id": "org.couchdb.user:me",
"_rev": "3-86c3801fdb8c32331f5f2580e861a765",
"name": "me",
"roles": [
],
"type": "user",
"password": "pwd"
}
所以,当我试图在这个用户进行身份验证,我得到以下错误:
So when I attempt to authenticate at this user, I get the following error:
{错误:BAD_REQUEST,理:缺password_sha属性的用户文档}
在我的本地安装的CouchDB,创造_users一个新的用户将自动创建哈希密码:
On my local CouchDB installation, creating a new user in _users would automatically create the hashed password:
{
"_id": "org.couchdb.user:test",
"_rev": "1-9c1c4360eba168468a37d7f623782d23",
"password_scheme": "pbkdf2",
"iterations": 10,
"name": "test",
"roles": [
],
"type": "user",
"derived_key": "4a122a20c1a8fdddb5307c29078e2c4269abffa5",
"salt": "36c0c05cf2a3ee321eabd10c46a8aa2a"
}
我试图复制_design / _auth从我的本地CouchDB的安装文件Cloudant,但结果都是一样的 - 没有哈希密码
I tried copying the "_design/_auth" document from my local CouchDB installation to Cloudant, but the results are the same - no hashed password.
我似乎已经关闭了在某些点上轨,但我不知道在哪里发生这种情况。我如何设置Cloudant使用同一种权威性的定期CouchDB的?
I appear to have gone off the rails at some point, but I'm not sure where this happened. How can I set up Cloudant to use the same kind of auth as regular CouchDB?
推荐答案
我发现通过#cloudant IRC答案:
I found the answer via #cloudant IRC:
09:59 1 + kocolosk>创建_users是正确的事情。
09:59 1 + kocolosk>该API的旧版本的CouchDB的其中密码需要散列客户端匹配
09:59 <+kocolosk> the API matches an older version of CouchDB where the passwords needed to hashed client-side
&10:00 LT; jbeard>哦,我明白了。
10:00 < jbeard> oh, I see
10:00 1 + kocolosk>我们正在解决该自动散列缺乏支持
10:00 <+kocolosk> we're addressing that lack of support for automatic hashing
&10:01 LT; jbeard>我试图找到客户端的散列文档中沙发上。
10:01 < jbeard> I'm trying to find documentation on client-side hashing in Couch.
&10:02 LT; jbeard>什么版本的沙发是Cloudant目标是成为与_users兼容?
10:02 < jbeard> What version of Couch is Cloudant aiming to be compatible with for _users?
10:04 1 + kocolosk> jbeard:
10:04 <+kocolosk> jbeard: http://wiki.apache.org/couchdb/Security_Features_Overview
10时04分1 + kocolosk>请参阅生成password_sha(仅适用于1.1.x和更早版本)
10:04 <+kocolosk> see "Generating password_sha (only applicable for 1.1.x and earlier)"
10:04 1 + kocolosk> jbeard:这个特殊的特点是最后一位,我们与1.1.x的兼容,但没有新的版本。
10:04 <+kocolosk> jbeard: this particular feature is the last bit where we are compatible with 1.1.x but not newer version
&10:05 LT; jbeard>出色
10:05 < jbeard> Excellent
&10:05 LT; jbeard>这就是我需要知道什么
10:05 < jbeard> That's what I needed to know
这篇关于Cloudant AUTH:缺乏_users数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!