<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>willnorris.com &#187; xrd</title>
	<atom:link href="http://willnorris.com/tag/xrd/feed" rel="self" type="application/rss+xml" />
	<link>http://willnorris.com</link>
	<description>there&#039;s more to life than this</description>
	<lastBuildDate>Tue, 15 May 2012 21:57:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-beta3-20574</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
		<item>
		<title>The Open Stack (in PHP)</title>
		<link>http://willnorris.com/2009/03/the-open-stack-in-php</link>
		<comments>http://willnorris.com/2009/03/the-open-stack-in-php#comments</comments>
		<pubDate>Thu, 19 Mar 2009 20:35:43 +0000</pubDate>
		<dc:creator>Will Norris</dc:creator>
				<category><![CDATA[identity]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[diso]]></category>
		<category><![CDATA[lrdd]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[open stack]]></category>
		<category><![CDATA[openid]]></category>
		<category><![CDATA[xrd]]></category>
		<category><![CDATA[xrds]]></category>
		<category><![CDATA[xrds-simple]]></category>

		<guid isPermaLink="false">http://willnorris.com/?p=533</guid>
		<description><![CDATA[A couple of months or so ago, I made a conscious shift in my focus with the DiSo Project. Instead of continuing to concentrate on some of the higher level deliverables like WordPress plugins, I decided it was time to step back and evaluate where the development community (specifically the PHP development community) is with [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of months or so ago, I made a conscious shift in my focus with the <a href="http://diso-project.org/">DiSo Project</a>.  Instead of continuing to concentrate on some of the higher level deliverables like WordPress plugins, I decided it was time to step back and evaluate where the development community (specifically the PHP development community) is with the Open Stack.  For the purposes of this discussion, I&#8217;m going to use <a href="http://netmesh.info/jernst/2008/11/05">Johannes Ernst&#8217;s</a> redux of <a href="http://www.flickr.com/photos/56624456@N00/3020508770/">John McCrea&#8217;s</a> Open Stack graphic.  I&#8217;m also only going to concentrate on three of the middle components: Metadata Discovery, Authentication, and Access Control.</p>

<p><img src="http://farm4.static.flickr.com/3462/3367793731_45903b3cab_o.png" alt="The Open Stack" title="The Open Stack" style="display: block; border: 1px solid #000; margin: auto; padding: 1px;" /></p>

<p><span id="more-533"></span></p>

<h2>PHP</h2>

<p>First a quick note, to make sure this discussion does not get derailed.  There is a time and a place to talk about these topics in the abstract.  That is incredibly important work, especially in the development of these specifications, but that&#8217;s not what I&#8217;m currently interested in.  I&#8217;m focused on developing solid PHP libraries to implement these technologies.  Why PHP?  Because that&#8217;s what WordPress uses, which is the current platform I&#8217;m targeting with the work I&#8217;m doing in DiSo.  I know that PHP isn&#8217;t as sexy as Python or Ruby, but it&#8217;s what we&#8217;re using.  I agree that we need solid libraries written in these other languages as well, but that&#8217;s not my focus.  PHP is widely deployed and used, including companies very involved in implementing the Open Stack like Facebook and Plaxo (Luke, Joseph &#8212; I&#8217;m expecting some help from you guys :) ).</p>

<p>I&#8217;ll also note that I&#8217;m specifically targeting PHP 5.  PHP 4 is no longer supported, and maintaining backwards compatibility (especially when talking about XML parsing) is a complete pain.  This creates a problem with getting code into WordPress core, but I&#8217;m okay with that&#8230; they&#8217;ll move to PHP 5 eventually.</p>

<h2>OpenID</h2>

<p>Let&#8217;s start with the most mature library we&#8217;ve got.  JanRain made a huge name for themselves in the OpenID community a couple of years ago by providing <a href="http://openidenabled.com/">open source libraries</a> in a number of different languages, including of course PHP.  Like any library, there are a few weird things here and there, but by and large it is an excellent implementation that has served the community (including this developer) very well.  Last week, <a href="http://openid.net/pipermail/code/2009-March/000000.html">JanRain announced</a> that they were restructuring the development process of the PHP library to make it more open to developers.  The code itself has moved from their internal darcs repository <a href="http://github.com/bce/php-openid/">to github</a>, they&#8217;ve added <a href="http://www.sociallipstick.com/">Luke Shepard</a> of Facebook and myself as committers, and releases, bug tracking, etc will eventually be moved to the Google Code project.  Going forward, we&#8217;ll be looking at trimming down the library a bit, removing support in core for older protocol versions and edge cases that weren&#8217;t really used, and overall making it easier for developers to use.</p>

<h2>OAuth</h2>

<p>There are two OAuth PHP libraries that I&#8217;m aware of, the &#8220;official&#8221; library stored in the <a href="http://code.google.com/p/oauth/source/browse/#svn/code/php">OAuth Google Code project</a>, and the <a href="http://code.google.com/p/oauth-php/source/browse/#svn/trunk/library">Mediamatic library</a> from Marc Worrell.  The former library seems to have more users because of it&#8217;s exposure from the OAuth website, and is <strong>much</strong> lighter weight than the Mediamatic library (too much so for my taste).  I initially chose the Mediamatic library for my work in getting OAuth working with WordPress, but eventually found some problems with the general library architecture.  After <a href="http://groups.google.com/group/oauth-php/browse_thread/thread/e78feefe1d568c87">some discussion</a> with developers of both libraries, I&#8217;ve begun work on a <a href="http://github.com/willnorris/oauth-php/">new OAuth library</a>.  I re-architected the library from scratch, and then used a combination of the two libraries for much of the actual implementations.  It&#8217;s probably about 80+ percent done, and should hopefully provide something both communities can work with.</p>

<h2>Metadata Discovery</h2>

<p>Discovery has certainly received the least amount of love from the development community, which is a bit ironic given that it&#8217;s a foundational part of almost every application of the Open Stack.  There&#8217;s no shortage of metadata discovery and parsing libraries: Joseph Smarr contributed one to the <a href="http://code.google.com/p/xrds-simple/source/browse/code/php/XrdsSimpleParser.php">xrds-simple Google Code repository</a>, the OpenID library <a href="http://github.com/bce/php-openid/tree/master/Auth/Yadis">has its own</a>, and the Mediamatic OAuth library <a href="http://code.google.com/p/oauth-php/source/browse/trunk/library/discovery/xrds_parse.php">has its own</a>.  Yet amazingly, none of these help you at all if you&#8217;re wanting to manipulate or publish a metadata document.  They&#8217;re all half-baked, each written for a very specific use-case.  What we need is a full implementation of the discovery protocols.  And that, of course, is where it gets a little more complicated&#8230;</p>

<p><strong>Disclaimer</strong>: If you really want everything there is to know about this subject, go read the writings of <a href="http://www.hueniverse.com/">Eran Hammer-Lahav</a>&#8230; I&#8217;m just going to gloss over it a bit.</p>

<p>Metadata discovery includes two steps: you need to know how to get the metadata about a resource, and you need to know what format that metadata is in so that you can parse it and make sense of it.  OpenID uses a technology known as <a href="http://yadis.org/">Yadis</a> to retrieve the metadata document, which is in an XML language known as <a href="http://en.wikipedia.org/wiki/XRDS">XRDS</a> (Extensible Resource Descriptor Sequence).  <a href="http://oauth.net/discovery/">OAuth Discovery</a> uses a combined and simplified version of these two known as <a href="http://xrds-simple.net/">XRDS-Simple</a>.  Discovery for OpenID and OAuth is more-or-less compatible.</p>

<p>Now, there is also work being done in the <a href="http://www.oasis-open.org/committees/xri/">OASIS XRI TC</a> (of which I&#8217;m a member) to develop the simpler, and more uniform successor to these protocols.  Retrieval of the metadata will use a collection of methods known as <a href="http://www.hueniverse.com/hueniverse/2009/03/the-discovery-protocol-stack.html">LRDD</a> (pronounced &#8220;lard&#8221;), while the metadata     itself will be in a much simpler format known as <a href="http://www.hueniverse.com/hueniverse/2009/03/xrd-document-structure.html">XRD</a>.  While identical in spirit, these are complete rewrites of the previous specs.  The new specs are not compatible with the old, but they are also designed so that they do not conflict either, so that both may be used simultaneously.  Shifting to these new discovery protocols will certainly not be easy, but believe me when I tell you that it will be worth it.  In fact, it&#8217;s absolutely essential for players like Google to implement OP-driven identifier selection (allowing users to login with OpenID by simply entering &#8220;gmail.com&#8221;).</p>

<p>So as I said earlier, we don&#8217;t have any real good discovery libraries for PHP.  As part of my work on WordPress, I started development on a <a href="http://github.com/willnorris/php-xrd/tree/master">XRDS-Simple library</a> in PHP.  More recently, I created a <a href="http://github.com/willnorris/php-xrd/tree/XRD">separate branch</a> of the code which implements LRDD+XRD exclusively.  Realistically, we&#8217;ll probably need a library which handles both the old and new protocols for a while.  The idea would be that none of the higher level libraries like OpenID or OAuth need worry about metadata discovery, except for maybe a lightweight wrapper around the discovery library.  The new OAuth library I&#8217;m working on will do this from day one; the existing OpenID library will take a little while, but I think we&#8217;ll eventually see it rely on a separate library for discovery.</p>

<h2>Feedback and Help</h2>

<p>First of all, I welcome any feedback on the implementations that currently exist, especially the OAuth and discovery libraries I&#8217;m working on.  They are not complete and most certainly not production ready, but they&#8217;re getting close.  I&#8217;d also like to solicit development help, especially from people with larger deployments and/or a vested interest in this technology.  All the new development is happening on github, so creating a clone to hack on is incredibly simple.  Even if you don&#8217;t have development cycles you can put into this, I&#8217;ve already got at least one technical decision I need to make that I&#8217;d love feedback on, which I&#8217;ll be covering in my next post: &#8220;<a href="http://willnorris.com/2009/03/http-client-library-for-php">Why Does HTTP Suck So Much in PHP</a>&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://willnorris.com/2009/03/the-open-stack-in-php/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Challenges in changing my OpenID</title>
		<link>http://willnorris.com/2008/12/challenges-in-changing-my-openid</link>
		<comments>http://willnorris.com/2008/12/challenges-in-changing-my-openid#comments</comments>
		<pubDate>Fri, 19 Dec 2008 22:35:21 +0000</pubDate>
		<dc:creator>Will Norris</dc:creator>
				<category><![CDATA[identity]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[openid]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[xrd]]></category>
		<category><![CDATA[xrds-simple]]></category>

		<guid isPermaLink="false">http://willnorris.com/?p=457</guid>
		<description><![CDATA[I recently decided to combine two personal websites I had (this one, willnorris.com, and will.norris.name) so that I had a single web presence. I chose to use willnorris.com as my canonical URL, but this presented two problems: I have been listing will.norris.name as my homepage in my various social networks profiles and on blog comments. [...]]]></description>
			<content:encoded><![CDATA[<p>I recently decided to combine two personal websites I had (this one, willnorris.com, and will.norris.name) so that I had a single web presence.  I chose to use willnorris.com as my canonical URL, but this presented two problems:</p>

<ul>
<li><p>I have been listing will.norris.name as my homepage in my various social networks profiles and on blog comments.  I&#8217;ve built up some Google page rank love through these links, and I want to make sure that is transferred over to willnorris.com.  I also want any visitors that go to will.norris.name to be sent over to willnorris.com.  The easiest (and correct) way to accomplish both of these is to setup a simple 301 &#8220;Moved Permanently&#8221; redirect.</p></li>
<li><p>I have also been using will.norris.name as my primary OpenID to login to numerous websites.  Many OpenID consumers will allow you to connect multiple OpenIDs or at least change your OpenID, so I can go through them all and update my account.  But that will take a while, and I&#8217;d like to combine my domains now.  The problem is that if I go ahead and setup a 301 redirect (as mentioned above), then it breaks my ability to use will.norris.name as an OpenID (see #4 under <a href="http://openid.net/specs/openid-authentication-2_0.html#normalization">OpenID Normalization</a>).</p></li>
</ul>

<p>So I want Google and other visitors to see a permanent redirect to willnorris.com, but I don&#8217;t want to break my ability to use will.norris.name as an OpenID.  I was originally planning to use Apache to perform the redirect, and I wasn&#8217;t sure if I&#8217;d actually be able to find a solution to my problem.  Then I started thinking about WordPress request processing, and came up with the following bit of code:</p>

<pre><code>add_action('wp', 'redirect_wp');

function redirect_wp($wp) {
    // only redirect plain home page requests
    if (!is_front_page() &amp;&amp; !is_home()) return;
    if (!empty($_SERVER['QUERY_STRING'])) return;

    // don't redirect OpenID requests
    if (stripos($_SERVER['HTTP_ACCEPT'], 'application/xrds+xml') !== FALSE) return;
    if (stripos($_SERVER['HTTP_USER_AGENT'], 'openid') !== FALSE) return;
    if (empty($_SERVER['HTTP_USER_AGENT'])) return;

    wp_redirect('http://willnorris.com/', 301);
    exit;
}
</code></pre>

<p>So it&#8217;s pretty simple really&#8230; First, we only care about requests to the front page.  Because I was only using will.norris.name as a one-page identity site, not a full blog, I only need to worry with requests to the front page.  If I had been writing blog posts or other pages on this site, I would need to have different logic here.  Second, we do some basic detection for OpenID requests &#8212; things like the content negotiation header for XRDS, or the &#8220;openid&#8221; string that appears in the user agent of JanRain OpenID libraries.  If it doesn&#8217;t look like an OpenID request, we go ahead and redirect to willnorris.com.</p>

<p>Now of course this only works in my specific use case, but perhaps it will prove useful for others.  For what it&#8217;s worth, the new work we&#8217;re doing on <a href="http://groups.google.com/group/metadata-discovery">metadata discovery</a> with XRD would prevent this problem, since we&#8217;re moving away from overloading normal HTTP requests where possible.</p>

<p><strong>Update:</strong> I now also treat an empty user agent string as an OpenID request.  This covers Blogger, which uses the <a href="http://openid4java.org">OpenID4Java</a> library.  I&#8217;m fairly certain all major search engine spiders include a user agent, so this should be a fairly safe addition.</p>

<h3>Additional Note for FastCGI Users</h3>

<p>It&#8217;s worth noting as well that WordPress loses the HTTP status code when using FastCGI, as is used at Joyent.  A <a href="http://trac.wordpress.org/browser/tags/2.7/wp-includes/pluggable.php#L848">comment in the code</a> claims that it causes problems with some FastCGI setups, but I&#8217;ve not experienced that.  This is very important, because Google will not transfer your page rank repuation if only using a 302 &#8220;Moved Temporarily&#8221; redirect; it must be a 301.  A quick fix for this is to add the following to the very beginning of the above code:</p>

<pre><code>add_filter('wp_redirect_status', 
    create_function('$s', 'status_header($s); return $s;'));
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://willnorris.com/2008/12/challenges-in-changing-my-openid/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

