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:

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



No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.


This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

9 Responses to “mod_python OpenID Access Control”

  1. =wil Says:

    This is a test

  2. dready blog v2.0 » Blog Archive » This blog is OpenID enabled! Says:

    [...] dready blog v2.0 « mod_python OpenID Access Control [...]

  3. http://if20.net/ Says:

    Nice job. I will test it in my PC. Thanks.

  4. Does Google use PageRank? No. at 天真:天眞的我们必然幸福 Says:

    [...] 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? [...]

  5. http://openid.aol.com/alexissmirnov Says:

    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

  6. http-awz.openid.freelogy.org- Says:

    Thanks for the entry. –awz

  7. =gmw Says:

    Thats awesome wil. Can I join the Cult of Wil Worshipers?

  8. wil Says:

    @=gmw You have to first pay $100K to join the FeedWil Foundation first.

  9. slick deals Says:

    Thanks for the entry.

Leave a Reply

Please login with your OpenID to post a comment: