Author: jasondavies
Date: Thu Oct 15 22:57:13 2009
New Revision: 825693
URL: http://svn.apache.org/viewvc?rev=825693&view=rev
Log:
Add support for other OAuth signature methods in replication client.
To use, set auth.oauth.signature_method to either "HMAC-SHA1" (the
default if not specified) or "PLAINTEXT".
Modified:
couchdb/trunk/src/couchdb/couch_rep_httpc.erl
Modified: couchdb/trunk/src/couchdb/couch_rep_httpc.erl
URL:
http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep_httpc.erl?rev=825693&r1=825692&r2=825693&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep_httpc.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep_httpc.erl Thu Oct 15 22:57:13 2009
@@ -213,7 +213,16 @@
Token = ?b2l(proplists:get_value(<<"token">>, Props)),
TokenSecret = ?b2l(proplists:get_value(<<"token_secret">>, Props)),
ConsumerSecret = ?b2l(proplists:get_value(<<"consumer_secret">>, Props)),
- Consumer = {ConsumerKey, ConsumerSecret, hmac_sha1},
+ SignatureMethodStr = ?b2l(proplists:get_value(<<"signature_method">>,
Props, <<"HMAC-SHA1">>)),
+ SignatureMethodAtom = case SignatureMethodStr of
+ "PLAINTEXT" ->
+ plaintext;
+ "HMAC-SHA1" ->
+ hmac_sha1;
+ "RSA-SHA1" ->
+ rsa_sha1
+ end,
+ Consumer = {ConsumerKey, ConsumerSecret, SignatureMethodAtom},
Method = case Action of
get -> "GET";
post -> "POST";