Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

whitespace cleanup

  • Loading branch information...
commit 8e75a4672458e46c2159ffc5d3945b6b04900d84 1 parent a6eaabd
@tavisrudd authored
Showing with 15 additions and 14 deletions.
  1. +15 −14 src/oauth/signature.clj
View
29 src/oauth/signature.clj
@@ -1,6 +1,6 @@
-(ns
+(ns
#^{:author "Matt Revelle"
- :doc "OAuth client library for Clojure."}
+ :doc "OAuth client library for Clojure."}
oauth.signature
(:require [oauth.digest :as digest])
(:use [clojure.string :only [join]]))
@@ -21,7 +21,7 @@
(def secure-random (java.security.SecureRandom/getInstance "SHA1PRNG"))
-(defn rand-str
+(defn rand-str
"Random string for OAuth requests."
[length]
(. (new BigInteger (int (* 5 length)) ^java.util.Random secure-random) toString 32))
@@ -32,21 +32,23 @@
(defn url-form-encode [params]
(join "&" (map (fn [[k v]]
- (str (url-encode (as-str k)) "=" (url-encode (as-str v)))) params )))
+ (str (url-encode (as-str k))
+ "=" (url-encode (as-str v)))) params )))
(defn base-string
([method base-url c t params]
- (base-string method base-url (assoc params
- :oauth_consumer_key (:key c)
- :oauth_token (:token t)
- :oauth_signature_method (or (params :oauth_signature_method)
- (signature-methods (:signature-method c)))
- :oauth_version "1.0")))
+ (base-string method base-url
+ (assoc params
+ :oauth_consumer_key (:key c)
+ :oauth_token (:token t)
+ :oauth_signature_method (or (params :oauth_signature_method)
+ (signature-methods (:signature-method c)))
+ :oauth_version "1.0")))
([method base-url params]
(join "&" [method
- (url-encode base-url)
+ (url-encode base-url)
(url-encode (url-form-encode (sort params)))])))
-(defmulti sign
+(defmulti sign
"Sign a base string for authentication."
{:arglists '([consumer base-string & [token-secret]])}
(fn [c & r] (:signature-method c)))
@@ -88,9 +90,8 @@ requires RFC 3986 encoding."
:oauth_nonce (rand-str 30)
:oauth_version "1.0"})
([consumer token]
- (assoc (oauth-params consumer)
+ (assoc (oauth-params consumer)
:oauth_token token))
([consumer token verifier]
(assoc (oauth-params consumer token)
:oauth_verifier (str verifier))))
-
Please sign in to comment.
Something went wrong with that request. Please try again.