views:

669

answers:

1

I would like to use create a rails route for a user's open id. The url would look something like

http://mysite.com/identity/:html_encoded_openid
or
http://mysite.com/identity/:html_encoded_openid.xml

This would be so that the site could be queried for an open id and either view info for that identity or receive an xml document containing that information. Standard Rails stuff.

I am looking for your expertise on a few things:

  1. Standard rails routes seem to choke the .s in an openid so that:

    http://mysite.com/identity/openid

    would find a route but

    http://mysite.com/identity/openid.myopenid.com

    would not.

  2. What security issues would I need to look out for?

  3. Is there a better way to encode the query, perhaps with the querystring?

And I'd rather not do the standard friendly url method of using:

my-friendly-openid-com
or
23-my-friendly-openid-com

if possible.

+1  A: 

You could handle that second route with something like this (replace the action name with something real).

map.connect 'identity/:id', :controller => "identity", 
                            :action => "foo", 
                            :requirements => {:id => /(\w+\.?)+/}
jdl