Initial OAuth provider for Ring

39 views
Skip to first unread message

Pelle Braendgaard

unread,
Mar 2, 2010, 3:54:27 PM3/2/10
to ring-c...@googlegroups.com
I have added support for creating an OAuth Provider to my fork of Matt
Revelle's clj-oauth library.

http://github.com/pelle/clj-oauth

It is implemented as ring middleware.


(wrap-oauth app (fn [consumer token)
;; load consumer and token secrets from database
[consumer_secret,token_secret]
))

If the signature verifies it adds the following to the request:

- oauth-token
- oauth-consumer

There still is a lot todo:

- support query_string and form encoded oauth parameters
- support more signature methods
- check nonces for uniqueness
- further tests
- implement token request services, propably in a separate module.

I am still new at clojure, but I wrote most of the original OAuth Ruby
Gem so it's something I feel I can do while learning clojure.

Please do let me know if you have ideas for improving the code.

P
--
http://agree2.com - Reach Agreement!
http://extraeagle.com - Solutions for the electronic Extra Legal world
http://stakeventures.com - Bootstrapping blog

Mark McGranaghan

unread,
Mar 3, 2010, 10:06:26 AM3/3/10
to Ring
Hi Pelle,

Thanks for sharing this! I think that users will find the Ring
middleware useful for using OAth from Clojure web apps.

The wrap-oath function currently adds :oauth-token and :oauth-consumer
keys to the request map. Technically, the Ring 0.1 spec requires that
non-Ring components namespace keywords, for example like :clj-oauth/
token. But I'm thinking about relaxing this in 0.2, so I wouldn't
change it now. I'll post separately on this issue in more detail soon,
but I just wanted to give you the heads up in case you were wondering
about it.

I also have various comments about the Clojure code in general that
isn't related to Ring; email me off-list if you'de like to chat.

- Mark

> --http://agree2.com- Reach Agreement!http://extraeagle.com- Solutions for the electronic Extra Legal worldhttp://stakeventures.com- Bootstrapping blog

Reply all
Reply to author
Forward
0 new messages