How to auth between Ruby and web2py apps?

10 views
Skip to first unread message

weheh

unread,
May 6, 2009, 2:20:59 AM5/6/09
to web2py Web Framework
I'm still green when it comes to web2py auth and I'm faced with
integrating a web2py app with a Ruby app, of which I know nothing.
Does anyone out there know enough about both to suggest how to have
Ruby do user auth but then pass a certificate to web2py auth? I'm not
sure I can figure this one out quickly, but it certainly seems like a
useful thing to know how to do (I'm for peace with Ruby and all
others, not war).

mdipierro

unread,
May 6, 2009, 9:45:34 AM5/6/09
to web2py Web Framework
On May 6, 1:20 am, weheh <richard_gor...@verizon.net> wrote:
> I'm still green when it comes to web2py auth and I'm faced with
> integrating a web2py app with a Ruby app, of which I know nothing.
> Does anyone out there know enough about both to suggest how to have
> Ruby do user auth but then pass a certificate to web2py auth?

It is certainly possible. Does your Ruby app already have an
authentication mechanism? Which one?
if not, I suggest you use CAS for federated authentication.
Both Ruby (http://code.google.com/p/rubycas-client/)
and web2py (https://www.web2py.com/cas)
support it. It is only a matter of configuring the parameters right.

Massimo

> I'm not
> sure I can figure this one out quickly, but it certainly seems like a
> useful thing to know how to do (I'm for peace with Ruby and all
> others, not war).

We too.

weheh

unread,
May 6, 2009, 9:42:41 PM5/6/09
to web2py Web Framework
Hi Massimo,
All I know so far is that the Ruby app is going to use "basic access
authentication". My app is a black-box slave and will be accessed via
api calls that return JSON data structures. I'm hoping this can be a
minor poster-child for web2py because it's going to be the heart of
the reservation system of the hottest new club in NYC (the club has
been written up in NY Times, Vogue, Wall Street Journal, Conde Nast
Traveler, and other major magazines, so it's got major buzz). Anyway,
I will do my best to try to get a mention for web2py in the website,
but no promises since I'm in a secondary role. I'll keep you posted
about the authentication mechanism being used as soon as I get more
details. Until then, can you infer anything from "basic access
authentication" as per http://en.wikipedia.org/wiki/Basic_access_authentication?

mdipierro

unread,
May 7, 2009, 1:21:36 AM5/7/09
to web2py Web Framework
Let me think about this.

Francisco Gama

unread,
May 7, 2009, 9:42:52 PM5/7/09
to web2py Web Framework

xml-rpc over ssl?

mdipierro

unread,
May 7, 2009, 10:02:41 PM5/7/09
to web2py Web Framework
If ruby uses basic access authentication create a ruby action that can
only accessed by authenticate users and returns 404 otherwise.

Then in web2py you can do

def is_authenticated_by_rails(username,password,url):
import urllib, urlib2, base64
headers={}
headers['Authorization'] = 'Basic '+base64.b64encode(username
+':'+password)
request = urllib2.Request(url, {}, headers)
try:
urllib2.urlopen(req).read()
return True
except:
return False


On May 6, 8:42 pm, weheh <richard_gor...@verizon.net> wrote:
Reply all
Reply to author
Forward
0 new messages