mod_python OpenID Access Control
Since XRI is pretty much in bed with OpenID and NeuStar is an XRI shop, I get to play around with it quite a bit.
Here’s a little success report about using JanRain’s mpopenid module to protect certain restricted resources served by Apache. It works somewhat like your basic HTTP authentication, but instead of returning a 401 Authorization Required response causing the browser to prompt for username and password, it redirects you to the OpenID login page. Pretty neat eh?
So, here’s how we go about doing it.
My ingredients:
- Apache 2.2.4
- Python 2.5
- mod_python 3.2.10
- JanRain’s Python OpenID library combo 1.2.0 (which includes dependencies: Yadis 1.1.0 + urljr 1.0.1)
- mpopenid 1.2.0-pre5 (yet to be released on the main project site which is still showing 1.0.0)
Following the recipes in this README file, I was able to set it up with one caveat: Python ElementTree module is a dependency of the Python Yadis library and you need to first install that.
Did I mention that you could login using an I-name?
UPDATE:
The following patch for mpopenid.py is needed to make i-name login work:
--- mpopenid-1.2.0-pre5/mpopenid.py Tue Nov 21 20:24:53 2006
+++ mpopenid-1.2.0-pre5-wil/mpopenid.py Sun Jan 14 16:12:16 2007
@@ -157,10 +157,17 @@
url = s.strip()
if not url:
continue
- parsed = urlparse.urlparse(url)
- if not (parsed[0] and parsed[1]):
- url = ‘http://’ + url
- urls.append(urinorm(url))
+
+ if (url[0:6].lower() == “xri://”):
+ url = url[6:] # strip “xri://”
+
+ if (url[0] not in “=@!$+”): # doesn’t look like an XRI
+ parsed = urlparse.urlparse(url)
+ if not (parsed[0] and parsed[1]):
+ url = ‘http://’ + url
+ url = urinorm(url)
+
+ urls.append(url)
return urls
January 15th, 2007 at 11:19 am
This is a test
January 15th, 2007 at 12:35 pm
[...] dready blog v2.0 « mod_python OpenID Access Control [...]
January 15th, 2007 at 10:23 pm
Nice job. I will test it in my PC. Thanks.
January 15th, 2007 at 10:46 pm
[...] 15th, 2007 · Filed: Wordpress · OpenID · No Comments · Popularity: 1% # mod_python OpenID Access Control Here’s a little success reportabout using JanRain’s mpopenid module to protect certain restricted resources served by Apache. It works somewhat like your basic HTTP authentication, but instead of returning a 401 Authorization Required response causing the browser to prompt for username and password, it redirects you to the OpenID login page. Pretty neat eh? [...]
February 16th, 2007 at 5:55 am
Every AOL account now has its own openID
http://journals.aol.com/panzerjohn/abstractioneer/entries/2007/02/15/aol-and-openid-where-we-are/1406
Trying mine
June 3rd, 2007 at 11:50 am
Thanks for the entry. –awz
August 1st, 2007 at 6:58 am
Thats awesome wil. Can I join the Cult of Wil Worshipers?
August 2nd, 2007 at 5:12 pm
@=gmw You have to first pay $100K to join the FeedWil Foundation first.