summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_httpd_oauth.erl
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2010-09-27 19:14:37 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2010-09-27 19:14:37 +0000
commit6c6db011c2064597526c6f36878a282238dd2bf2 (patch)
tree9875a3237a385b3ff9d9f53be7642bafbabcbbfa /src/couchdb/couch_httpd_oauth.erl
parentc4e2e1416bcedbe654d56c3851a0d08cddfc4bee (diff)
Replacing calls to couch_util:get_value with ?getv
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1001879 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_oauth.erl')
-rw-r--r--src/couchdb/couch_httpd_oauth.erl20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/couchdb/couch_httpd_oauth.erl b/src/couchdb/couch_httpd_oauth.erl
index 05ee10e2..18e95b3c 100644
--- a/src/couchdb/couch_httpd_oauth.erl
+++ b/src/couchdb/couch_httpd_oauth.erl
@@ -18,7 +18,7 @@
% OAuth auth handler using per-node user db
oauth_authentication_handler(#httpd{mochi_req=MochiReq}=Req) ->
serve_oauth(Req, fun(URL, Params, Consumer, Signature) ->
- AccessToken = couch_util:get_value("oauth_token", Params),
+ AccessToken = ?getv("oauth_token", Params),
case couch_config:get("oauth_token_secrets", AccessToken) of
undefined ->
couch_httpd:send_error(Req, 400, <<"invalid_token">>,
@@ -44,14 +44,14 @@ set_user_ctx(Req, AccessToken) ->
case couch_auth_cache:get_user_creds(Name) of
nil -> Req;
User ->
- Roles = couch_util:get_value(<<"roles">>, User, []),
+ Roles = ?getv(<<"roles">>, User, []),
Req#httpd{user_ctx=#user_ctx{name=Name, roles=Roles}}
end.
% OAuth request_token
handle_oauth_req(#httpd{path_parts=[_OAuth, <<"request_token">>], method=Method}=Req) ->
serve_oauth(Req, fun(URL, Params, Consumer, Signature) ->
- AccessToken = couch_util:get_value("oauth_token", Params),
+ AccessToken = ?getv("oauth_token", Params),
TokenSecret = couch_config:get("oauth_token_secrets", AccessToken),
case oauth:verify(Signature, atom_to_list(Method), URL, Params, Consumer, TokenSecret) of
true ->
@@ -88,7 +88,7 @@ serve_oauth_authorize(#httpd{method=Method}=Req) ->
'GET' ->
% Confirm with the User that they want to authenticate the Consumer
serve_oauth(Req, fun(URL, Params, Consumer, Signature) ->
- AccessToken = couch_util:get_value("oauth_token", Params),
+ AccessToken = ?getv("oauth_token", Params),
TokenSecret = couch_config:get("oauth_token_secrets", AccessToken),
case oauth:verify(Signature, "GET", URL, Params, Consumer, TokenSecret) of
true ->
@@ -100,7 +100,7 @@ serve_oauth_authorize(#httpd{method=Method}=Req) ->
'POST' ->
% If the User has confirmed, we direct the User back to the Consumer with a verification code
serve_oauth(Req, fun(URL, Params, Consumer, Signature) ->
- AccessToken = couch_util:get_value("oauth_token", Params),
+ AccessToken = ?getv("oauth_token", Params),
TokenSecret = couch_config:get("oauth_token_secrets", AccessToken),
case oauth:verify(Signature, "POST", URL, Params, Consumer, TokenSecret) of
true ->
@@ -129,24 +129,24 @@ serve_oauth(#httpd{mochi_req=MochiReq}=Req, Fun, FailSilently) ->
end
end,
HeaderParams = oauth_uri:params_from_header_string(AuthHeader),
- %Realm = couch_util:get_value("realm", HeaderParams),
+ %Realm = ?getv("realm", HeaderParams),
Params = proplists:delete("realm", HeaderParams) ++ MochiReq:parse_qs(),
?LOG_DEBUG("OAuth Params: ~p", [Params]),
- case couch_util:get_value("oauth_version", Params, "1.0") of
+ case ?getv("oauth_version", Params, "1.0") of
"1.0" ->
- case couch_util:get_value("oauth_consumer_key", Params, undefined) of
+ case ?getv("oauth_consumer_key", Params, undefined) of
undefined ->
case FailSilently of
true -> Req;
false -> couch_httpd:send_error(Req, 400, <<"invalid_consumer">>, <<"Invalid consumer.">>)
end;
ConsumerKey ->
- SigMethod = couch_util:get_value("oauth_signature_method", Params),
+ SigMethod = ?getv("oauth_signature_method", Params),
case consumer_lookup(ConsumerKey, SigMethod) of
none ->
couch_httpd:send_error(Req, 400, <<"invalid_consumer">>, <<"Invalid consumer (key or signature method).">>);
Consumer ->
- Signature = couch_util:get_value("oauth_signature", Params),
+ Signature = ?getv("oauth_signature", Params),
URL = couch_httpd:absolute_uri(Req, MochiReq:get(raw_path)),
Fun(URL, proplists:delete("oauth_signature", Params),
Consumer, Signature)