<?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/"
	>

<channel>
	<title>Stuff Yaron Finds Interesting &#187; Tech</title>
	<atom:link href="http://www.goland.org/category/technology/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.goland.org</link>
	<description>Technology, Politics, Food, Finance, etc.</description>
	<lastBuildDate>Sat, 21 Aug 2010 23:18:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Building full delegation in OAuth &#8211; This time in English</title>
		<link>http://www.goland.org/oauthgenericdelegation/</link>
		<comments>http://www.goland.org/oauthgenericdelegation/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 05:29:28 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[SOA/Web/Etc.]]></category>

		<guid isPermaLink="false">http://www.goland.org/?p=787</guid>
		<description><![CDATA[OAuth enables a very simple type of delegation, a user can delegate permissions between two services that they have accounts on. In other words, OAuth lets a user delegate permission to themself. But full delegation allows arbitrary users of arbitrary services to give permissions to each other. In this article I summarize the two key [...]]]></description>
			<content:encoded><![CDATA[     <p class="indent" >    <span class="aer-9">OAuth enables a very simple type of delegation, a user can delegate</span>
     <span class="aer-9">permissions between two services that they have accounts on. In other</span>
     <span class="aer-9">words,  OAuth  lets  a  user  delegate  permission  to  themself.  But  full</span>
     <span class="aer-9">delegation allows arbitrary users of arbitrary services to give permissions</span>
     <span class="aer-9">to each other. In this article I summarize the two key extensions to OAuth</span>
     <span class="aer-9">needed to enable it to do full delegation. The first is &#8217;on behalf of&#8217; (e.g.</span>
     <span class="aer-9">a service saying &#8221;I am making this request on behalf of user X&#8221;) and the</span>
     <span class="aer-9">second is a very simple directory service. The rest of the article tries to</span>
     <span class="aer-9">use something like plain English to explain how these features could work</span>
     <span class="aer-9">in OAuth.</span>
<span id="more-787"></span>
       <h3 class="likesectionHead"><a id="x1-1000"></a><span class="aer-9">Contents</span></h3>
       <div class="tableofcontents">
       <span class="sectionToc" ><span class="aer-9">1 </span><a href="#x1-20001" id="QQ2-1-2"><span class="aer-9">Kicking OAuth delegation up to 11</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">2 </span><a href="#x1-30002" id="QQ2-1-3"><span class="aer-9">The first step on the road to general delegation - target user</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">3 </span><a href="#x1-40003" id="QQ2-1-4"><span class="aer-9">The next step on the road to general delegation - on behalf of</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">4 </span><a href="#x1-50004" id="QQ2-1-5"><span class="aer-9">Making on behalf of actually work - discovery</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">5 </span><a href="#x1-60005" id="QQ2-1-6"><span class="aer-9">Another nice feature of discovery</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">6 </span><a href="#x1-70006" id="QQ2-1-7"><span class="aer-9">Conclusion</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">A </span><a href="#x1-8000A" id="QQ2-1-8"><span class="aer-9">Some odds and ends</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">B </span><a href="#x1-9000B" id="QQ2-1-9"><span class="aer-9">How exactly did Live calendar provision with Yahoo calendar?</span></a></span>
                                                                  

                                                                  
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">B.1 </span><a href="#x1-10000B.1" id="QQ2-1-10"><span class="aer-9">Establishing a secure communication channel</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">B.2 </span><a href="#x1-11000B.2" id="QQ2-1-11"><span class="aer-9">A shared application protocol</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">C </span><a href="#x1-12000C" id="QQ2-1-12"><span class="aer-9">How did Yochi&#8217;s discovery server come to list Yahoo calendar as Yochi&#8217;s</span>
     <span class="aer-9">calendar service?</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">D </span><a href="#x1-13000D" id="QQ2-1-13"><span class="aer-9">And why was Live calendar allowed to discover who Yochi&#8217;s calendar service is anyway?</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">E </span><a href="#x1-14000E" id="QQ2-1-14"><span class="aer-9">What if Leon wanted to ask Yochi for permission to see his free/busy time?</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">F </span><a href="#x1-15000F" id="QQ2-1-15"><span class="aer-9">Where can I go to learn more? (Read: I&#8217;m having trouble sleeping)</span></a></span>
       </div>

<!--l. 45--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">1   </span> <a id="x1-20001"></a>Kicking OAuth delegation up to 11</h3>
<!--l. 47--></p><p class="noindent" >Delegation is all about transferring permissions. At its most general a delegation
expresses something like &#8221;User X of service Y gives permission Z to user A of service
B&#8221;. Today OAuth cannot express this statement because OAuth always assumes that
X = A. In other words what OAuth can say is &#8221;The user of service Y gives
permission Z to their own account on service B.&#8221;
<!--l. 54--></p><p class="indent" >   With general delegation a user of Sharepoint Online can give permission to a user
of Google Docs to see the Sharepoint Online user&#8217;s documents from inside of Google
Docs. Or, as explored below, a user of Yahoo calendar can give permission to a user
of Live calendar to see the Yahoo calendar user&#8217;s free/busy time from inside of
Live calendar. With full delegation we can finally start having truly <a href="http://www.goland.org/openpermission/" >open
permissions</a>.
<!--l. 62--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">2   </span> <a id="x1-30002"></a>The first step on the road to general delegation - target user</h3>
<!--l. 64--></p><p class="noindent" >Imagine that we added one feature to OAuth, the ability in a permission request to
specify who the target user is. This would enable us to make the following
statement in OAuth &#8221;The user of service Y gives permission Z to user A
of service B&#8221;. But how do we identify user A? We already have a pretty
good solution to how to identify users, e-mail addresses. So let&#8217;s go with
that.
<!--l. 71--></p><p class="indent" >   But now imagine the user experience. Yochi, who uses Yahoo Calendar, wants to
give Leon, who uses Live Calendar, permission to see his free/busy time. Using the
new &#8217;target user&#8217; functionality Yochi can say to Yahoo Calendar &#8221;Hey, Yahoo
Calendar, give leon@bogus.gmail.com who uses Live Calendar the right to see my
free/busy time.&#8221; Yahoo calendar can now make a three legged OAuth request to Live
Calendar and specify that the permission to be granted, free/busy time read
capability, is to be given to the user leon@gmail.com.
                                                                  

                                                                  
<!--l. 80--></p><p class="indent" >   But how does Live Calendar know who is giving the permission? In other words,
how does Live Calendar know that Yochi is the one granting the permission to
Leon? If all we add is Target User then what will have to happen is that
Yochi will have to be sent to a browser pointed at Live Calendar who will
then require Yochi to prove his identity. Personally I think that <a href="http://www.goland.org/adhocauthentication/" >oauth</a> can
handle that part just fine but let&#8217;s just say we use OpenID. So now Yochi has
to login to Live Calendar via OpenID to prove to Live Calendar who he
is.
<!--l. 90--></p><p class="indent" >   The good news is that all the mechanics needed to make the previous work exists.
This is important because it will take a while for the machinery I describe below to
be ubiquitous so this is a reasonable fall back experience. But we can do better, much
better.
<!--l. 96--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">3   </span> <a id="x1-40003"></a>The next step on the road to general delegation - on behalf of</h3>
<!--l. 98--></p><p class="noindent" >In the previous section we added to OAuth the ability to specify the user who is the
target of a request using e-mail. What if we could also specify the identity of the user
the request is on behalf of? In other words, imagine we add an &#8217;OnBehalfOf&#8217; field to
OAuth? Now we have reached the fully generic semantics we talked about
above. We can make a statement of the form &#8221;Yahoo Calendar, on behalf of
Yochi@bogus.example.org, gives permission to see his free/busy time to
leon@bogus.gmail.com using the service Live Calendar.&#8221; The beauty of the previous
statement is that Yochi no longer needs to login to Live calendar to prove his
identity. So long as Live calendar believes that Yahoo calendar is authorized to act on
behalf of Yochi the entire permissioning step can be handled with no additional
UX.
<!--l. 111--></p><p class="indent" >   But this begs the question, why should Live calendar believe that Yahoo calendar
has the right to speak on Yochi&#8217;s behalf?
<!--l. 115--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">4   </span> <a id="x1-50004"></a>Making on behalf of actually work - discovery</h3>
<!--l. 117--></p><p class="noindent" >There are a number of ways that Live calendar can figure out if Yahoo calendar is
allowed to speak on behalf of Yochi. But a fairly straight forward way that
turns out to have some really nice capabilities (which I&#8217;ll get to in the next
section) is a discovery server. Imagine if Live calendar could take Yochi&#8217;s e-mail
address, Yochi@bogus.example.org and make a GET request of the form

https://bogus.example.org/.well-known/finger-service?user=Yochi@bogus.example.org&amp;service=URN:Services:calendar

and get back the URL for Yochi&#8217;s calendar service? Notice that as directories go this
is a fairly tame one. Queries consist of two fields (a user e-mail and a service ID) and
the response is one or more URIs. In this case if the URI returned to the query points
at Yahoo calendar than Live Calendar knows that Yahoo Calendar really
is authorized to make statements on Yochi&#8217;s behalf, at least in regards to
                                                                  

                                                                  
calendaring.
<!--l. 131--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">5   </span> <a id="x1-60005"></a>Another nice feature of discovery</h3>
<!--l. 133--></p><p class="noindent" >The calendar scenario is predicated on Yochi being able to specify that Leon&#8217;s
calendar is at Live Calendar. But how did Yochi know that? Did he ask Leon
where he keeps his calendar and then type in some URL pointing at Live
Calendar into Yahoo Calendar? Did he pick from a drop down? Ideally Yochi
could just say to Yahoo calendar &#8221;Hey, my friend Leon&#8217;s e-mail address is
leon@bogus.gmail.com, give him permission to see my free/busy time&#8221; and then
Yahoo calendar would handle the rest. Thanks to the discovery service that&#8217;s
possible.
<!--l. 142--></p><p class="indent" >   Yahoo  calendar  can  go  to

https://bogus.gmail.com/.well-known-finger-service?user=leon@bogus.gmail.com&amp;service=URN:Services:calendar

and get back the URL for Leon&#8217;s calendar service, in this case, Live calendar. And
then Yahoo can make an on-behalf of request and set up the permission. So Yochi
didn&#8217;t need to know where Leon&#8217;s calendar service was at. He just needed to know
Leon&#8217;s e-mail address.
<!--l. 149--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">6   </span> <a id="x1-70006"></a>Conclusion</h3>
<!--l. 151--></p><p class="noindent" >The goal was to enable generic delegation so that any user of any service can give
permissions to any user of any other service. To make this happen we needed to
introduce two key features. First was on behalf of (and the related target user).
Doing this required little more than adding two fields to OAuth requests
along with the idea that users are identified by e-mail addresses. Second was
discovery. By enabling a simple discovery server (two strings in, a list of
URIs out) we both enable users to find other user&#8217;s services as well as allow
services to figure out which services are allowed to act on behalf of which other
services.
<!--l. 162--></p><p class="indent" >   These two features give us the foundation for open permissions on the
Internet.
<!--l. 167--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">A   </span> <a id="x1-8000A"></a>Some odds and ends</h3>
<!--l. 169--></p><p class="noindent" >My goal with the previous article was to provide a very high level overview of how
full delegation could work in OAuth. In this appendix I provide a similar
high level overview of a number of ancillary features needed to fill out the
experience.
                                                                  

                                                                  
<!--l. 175--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">B   </span> <a id="x1-9000B"></a>How exactly did Live calendar provision with Yahoo calendar?</h3>
<!--l. 177--></p><p class="noindent" >In most OAuth contexts there is an assumption that two services have provisioned
with each other out of band and that&#8217;s why they can securely talk to each other. But
requiring everyone to provision out of band with everyone else is not a recipe for a
scalable web. What I think we want is the ability for any two arbitrary services
to be able to provision a relationship dynamically. There are two parts to
provisioning from a technical perspective. One part is establishing a secure
communication channel. The other part is establishing a shared application
protocol.
<!--l. 187--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">B.1   </span> <a id="x1-10000B.1"></a>Establishing a secure communication channel</h4>
<!--l. 189--></p><p class="noindent" >Establishing a secure communication channel generally means creating a mutually
authenticated connection, that is, a connection where both ends have authenticated
each other. Public key cryptography would be a great technology to use here were it
not that most of the languages/platforms used on the Internet do not have good
public key support. So instead I propose that we use SSL (ironically built on public
key cryptography but in a sufficiently low level way that there exist high quality wide
spread support) to establish a shared symmetric key between two services.
This key can then be used to sign things like request/access tokens (thus
authenticating the sender) over a SSL connection (thus authenticated the
receiver).
<!--l. 201--></p><p class="indent" >   Establishing the shared symmetric key requires two round trips. For example. let&#8217;s
say that Yahoo Calendar wants to provision with Live Calendar. Note that this
provisioning would only need to happen once. The symmetric key, once established,
could be used with all on behalf of requests between the services independent of the
users involved. In other words the symmetric key is provisioned between the services
directly.
     <ol class="enumerate1" >
     <li class="enumerate" id="x1-10002x1">Yahoo  calendar  (after  using  discovery  to  find  the  Live  calendar
     provisioning endpoint) would send a HTTPS request to Live calendar&#8217;s
     provisioning  endpoint  including  a  cryptographically  secure  random
     number.
     </li>
     <li class="enumerate" id="x1-10004x2">Live  calendar  (after  using  discovery  to  confirm  the  Yahoo  calendar
     provisioning endpoint) would send a HTTPS request to Yahoo calendar&#8217;s
     provisioning endpoint including both the cryptographically secure random
     number and the symmetric key that is to be used between the services.</li></ol>
<!--l. 218--></p><p class="noindent" >That&#8217;s it. The two services have now securely established a shared key that can be used
to sign tokens and prove identity. This same mechanism can also be used to generate
new keys when it&#8217;s time to do a key rollover.
                                                                  

                                                                  
<!--l. 224--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">B.2   </span> <a id="x1-11000B.2"></a>A shared application protocol</h4>
<!--l. 226--></p><p class="noindent" >As for the second part, the shared application protocol, the Internet is full of those.
Are we talking about a file or photo sharing service? WebDAV. Are we talking about
a content management system? Delta-V. calendar? CalDAV. You have a problem?
DAV has a protocol. :)
<!--l. 233--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">C   </span> <a id="x1-12000C"></a>How did Yochi&#8217;s discovery server come to list Yahoo calendar as Yochi&#8217;s
calendar service?</h3>
<!--l. 235--></p><p class="noindent" >In the scenario Yochi&#8217;s discovery service is at bogus.example.com but Yochi&#8217;s
calendaring service is at Yahoo. How did Yahoo tell bogus.example.com
to list Yahoo Calendar as Yochi&#8217;s discovery service? Making this work is
really just an application of bog standard OAuth. After setting up his Yahoo
Calendar, the Yahoo Calendar service would redirect Yochi with a standard
OAuth delegation request to Yochi&#8217;s discovery service to set itself as Yochi&#8217;s
calendaring service location. Yochi would confirm to his discovery service that
he agrees (again, this is bog standard OAuth) and the change would be
made.
<!--l. 247--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">D   </span> <a id="x1-13000D"></a>And why was Live calendar allowed to discover who Yochi&#8217;s calendar service
is anyway?</h3>
<!--l. 249--></p><p class="noindent" >It&#8217;s not a good idea to have discovery services sharing information about user&#8217;s
services to just anyone. So in our scenario the discovery service should have
demanded authentication from Live. But it seems doubtful that Yochi would have
thought to give Live permission to see his discovery data. What is more likely is that
Yochi set up his discovery service to allow anyone in his address book to see his
service locations and Leon is in his address book. So what should happen is that Live
should make an &#8217;on behalf of&#8217; request to Yochi&#8217;s discovery server in Leon&#8217;s name. But
how does Yochi&#8217;s discovery server know that Live Calendar is allowed to act on
behalf of Leon?
<!--l. 260--></p><p class="indent" >   The answer is that Yochi&#8217;s discovery service will make a request to Leon&#8217;s
discovery service on behalf of Yochi to find out Leon&#8217;s calendar service and see if it&#8217;s
Live Calendar. Leon&#8217;s discovery service can easily validate that Yochi&#8217;s discovery
service is allowed to act on Yochi&#8217;s behalf by matching Yochi&#8217;s e-mail address to the
discovery service location (e.g. they are both bogus.example.org) so it knows
everything is o.k. Since Yochi is in Leon&#8217;s address book, Leon&#8217;s discovery service will
respond to the request confirming that Live is allowed to act on behalf of Leon. And
now the scenario is complete. Yochi&#8217;s discovery service knows that Live can act on
behalf of Leon (at least in this context) and since Leon is in Yochi&#8217;s address book the
request for calendar location information from Live is positively responded
                                                                  

                                                                  
to.
<!--l. 276--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">E   </span> <a id="x1-14000E"></a>What if Leon wanted to ask Yochi for permission to see his free/busy
time?</h3>
<!--l. 278--></p><p class="noindent" >This article has worked on the scenario where Yochi wants to inform Leon that he
has been granted a permission. But a more general case is that Leon realizes he needs
access to Yochi&#8217;s free/busy time. This just requires adding a command to OAuth
&#8221;asking for permission&#8221; whose semantics are &#8221;User X of service Y asks for permission
Z from user A of service B&#8221;. But all the details of discovery, permissioning, etc. are
the same as above. Once user A reviews the request and approves it then the process
of notifying User X that they have received the permission is exactly as given
above.
<!--l. 289--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">F   </span> <a id="x1-15000F"></a>Where can I go to learn more? (Read: I&#8217;m having trouble sleeping)</h3>
<!--l. 291--></p><p class="noindent" >I&#8217;ve tried my best to keep this article focused on the big picture and in something
reasonably approximate to English. But I&#8217;ve written a series of articles going
into the gory details of how all this can be made to work. Those articles
are:
     <dl class="description"><dt class="description">
<a href="http://www.goland.org/openpermission/" ><span class="aebx-10">Open Permissions Matter for an Open Web</span></a> </dt><dd class="description">An argument for why open
     permissions matter and an exploration of the components needed to make
     them happen.
     </dd><dt class="description">
<a href="http://www.goland.org/oauthpermissioningexamples/" ><span class="aebx-10">The Outline of a Profile for Granting Permissions Using OAuth WRAP</span></a> </dt><dd class="description">
     Provides a sequence diagram and supporting material explaining how the
     basic protocol exchanges would work.
     </dd><dt class="description">
<a href="http://www.goland.org/simplewebfinger/" ><span class="aebx-10">Thoughts on Building a Finger Service</span></a> </dt><dd class="description">What I call a discovery service in
     this  article  was  more  traditionally  called  a  finger  service.  This  article
     explores key issues in designing a dirt simple finger service.
     </dd><dt class="description">
<a href="http://www.goland.org/adhocauthentication/" ><span class="aebx-10">Using OAuth WRAP and Finger for Ad-Hoc User Authentication</span></a> </dt><dd class="description">
     This is where I first introduce how to do ad-hoc provisioning (e.g. using
     two request/response pairs to establish a shared symmetric key). But I do
     it in the context of showing how OAuth can be used as a replacement for
     OpenID v1.
                                                                  

                                                                  
     </dd><dt class="description">
<a href="http://www.goland.org/managingfingerservice/" ><span class="aebx-10">Thoughts on Updating Finger Services</span></a> </dt><dd class="description">All   the   gory   details   on   how
     services can update user&#8217;s discovery services.</dd></dl>
<a id="Q1-1-16"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.goland.org/oauthgenericdelegation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Thoughts on updating finger services</title>
		<link>http://www.goland.org/managingfingerservice/</link>
		<comments>http://www.goland.org/managingfingerservice/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 20:27:09 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[SOA/Web/Etc.]]></category>

		<guid isPermaLink="false">http://www.goland.org/?p=781</guid>
		<description><![CDATA[Having a finger service as a directory to find information about users and services appears to be absolutely necessary if ad-hoc information sharing between people and services is to be possible. But just having a way to finger a person or service is less than 1/2 the battle. The real challenge is making it possible [...]]]></description>
			<content:encoded><![CDATA[<p class="indent" >    <span class="aer-9">Having a </span><a href="http://www.goland.org/simplewebfinger/" ><span class="aer-9">finger service</span></a> <span class="aer-9">as a directory to find information about users</span>
     <span class="aer-9">and  services  appears  to  be  absolutely  necessary  if  ad-hoc  information</span>
     <span class="aer-9">sharing between people and services is to be possible. But just having</span>
     <span class="aer-9">a way to finger a person or service is less than 1/2 the battle. The real</span>
     <span class="aer-9">challenge is making it possible for services to update their user&#8217;s finger</span>
     <span class="aer-9">information in an ad-hoc manner. I explore the issues around dynamic</span>
     <span class="aer-9">finger update in this article.</span>
<span id="more-781"></span>
       <h3 class="likesectionHead"><a id="x1-1000"></a><span class="aer-9">Contents</span></h3>
       <div class="tableofcontents">
       <span class="sectionToc" ><span class="aer-9">1 </span><a href="#x1-20001" id="QQ2-1-2"><span class="aer-9">Update a calendar services&#8217; location - a scenario</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">2 </span><a href="#x1-30002" id="QQ2-1-3"><span class="aer-9">Requirements</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">2.1 </span><a href="#x1-40002.1" id="QQ2-1-4"><span class="aer-9">Start with an absurdly simple data format</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">2.2 </span><a href="#x1-50002.2" id="QQ2-1-5"><span class="aer-9">Keep going with an absurdly simple protocol</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">2.3 </span><a href="#x1-60002.3" id="QQ2-1-6"><span class="aer-9">Updating the pointers</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">2.4 </span><a href="#x1-70002.4" id="QQ2-1-7"><span class="aer-9">Updating the access control permissions</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">2.5 </span><a href="#x1-80002.5" id="QQ2-1-8"><span class="aer-9">Submitting proposed permissions descriptions</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">3 </span><a href="#x1-90003" id="QQ2-1-9"><span class="aer-9">Updating the finger service, an example</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.1 </span><a href="#x1-100003.1" id="QQ2-1-11"><span class="aer-9">Wait a minute, what about the late bound e-mail security hole?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.2 </span><a href="#x1-110003.2" id="QQ2-1-12"><span class="aer-9">Isn&#8217;t the list of folks able to see the calendar going to likely be dynamic</span>
     <span class="aer-9">and so Google will be endlessly updating the finger permissions?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.3 </span><a href="#x1-120003.3" id="QQ2-1-13"><span class="aer-9">Does telling the requester about additional identifiers associated</span>
     <span class="aer-9">with the service open up a possible security hole?</span></a></span>
                                                                  

                                                                  
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.4 </span><a href="#x1-130003.4" id="QQ2-1-14"><span class="aer-9">Why couldn&#8217;t Google just ask for two identifiers in one request?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.5 </span><a href="#x1-140003.5" id="QQ2-1-15"><span class="aer-9">Oh come on, why isn&#8217;t this just LDAP?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.6 </span><a href="#x1-150003.6" id="QQ2-1-16"><span class="aer-9">Fine, if it&#8217;s not LDAP then why isn&#8217;t it WebDAV?</span></a></span>
<!--l. 44--><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">1   </span> <a id="x1-20001"></a>Update a calendar services&#8217; location - a scenario</h3>
<!--l. 46--></p><p class="noindent" >Dax has decided to host her personal calendar with Google. As part of the set up
process Google asks Dax if she wants to update her finger service to point her
calendar at Google. Dax agrees and is forwarded to the finger service along with a
request to add her Google calendar as a choice for her calendaring entry. Dax
authenticates to her finger service and her finger service prompts Dax for how she
would like, if at all, to include Google Calendar in her finger results. Dax specifies
that Google should be listed as her personal calendar service but not her business
calendar service.
<!--l. 57--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">2   </span> <a id="x1-30002"></a>Requirements</h3>
<!--l. 60--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">2.1   </span> <a id="x1-40002.1"></a>Start with an absurdly simple data format</h4>
<!--l. 62--></p><p class="noindent" >Directories bloat. One suspects it&#8217;s a corollary of <a href="http://en.wikipedia.org/wiki/Parkinson%27s_Law" >Parkinson&#8217;s Law</a> for data
(data expands to fill the space available for storage). But we don&#8217;t have to
start off bloated. We can start off with a directory that initially contains
exactly one table with two columns (on a per entity basis). One column is
the identifier of the service being sought and the other is the URI. Any
further information needs to be retrieved from the service being pointed
at.
<!--l. 70--></p><p class="indent" >   This approach has instant problems. For example let&#8217;s say we have an identifier
URN:SomeStandardOrgId:Calendar. But wait, the user has two calendars, one for
work and one for business. We can easily imagine returning two results. But
should we further disambiguate? Maybe have an entry for a personal versus a
business calendar? Surely there is other interesting data we could throw
in?
<!--l. 77--></p><p class="indent" >   It&#8217;s pretty bloody obvious that if finger is successful then before it&#8217;s done it will
look like LDAP (which, given its success and long history I&#8217;m going to guess probably
now looks a lot like DAP). So I&#8217;m not suffering from any illusions that this time it
will be simpler. No, it won&#8217;t. But every once in a while you have to burn the ships
                                                                  

                                                                  
and start anew.
<!--l. 84--></p><p class="indent" >   So my argument is that rather than putting in say a name/value bag that can be
searched on (and creating a language to go with it - should it be <a href="http://www.webdav.org/specs/rfc5323.html" >DASL</a> or
<a href="http://www.odata.org/" >OData</a>?) we either just have a single identifier for a calendar (and so can
return multiple results) and we also allow for more distinct identifiers such as
URN:SomeStandardOrgId:Calendar:Personal. In other words we hack the data into
the identifier.
<!--l. 92--></p><p class="indent" >   This will mean that the same service will be identified multiple times in the finger
service but that&#8217;s fine. Given that it is a non-goal to replace true directories but
rather to create an indirectory one suspects we can get pretty far with a very simple
proposal.
<!--l. 98--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">2.2   </span> <a id="x1-50002.2"></a>Keep going with an absurdly simple protocol</h4>
<!--l. 100--></p><p class="noindent" >It&#8217;s all just name/value pairs so the protocol should just focus on that. No need to
get fancy. For now we should just focus on reading/updating data in a single user&#8217;s
directory.
<!--l. 105--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">2.3   </span> <a id="x1-60002.3"></a>Updating the pointers</h4>
<!--l. 107--></p><p class="noindent" >When a service wants to update its user&#8217;s finger service it&#8217;s job, first and
foremost, is to provide a set of service identifiers and associated values that it
wants to update. So in theory an update should contain just two data points,
the service identifier (e.g. this is a calendar service) and the URI for that
service. The main downside to this approach is that it can potentially leave
the directory in an inconsistent state. In the previous calendar example we
showed how a single calendar service could show up under multiple service
identifiers. If the service is only allowed to change one pointer at a time and the
change is to replace one calendar service with another then the system can be
viewable halfway through the change. In ACID terms this means we don&#8217;t have
isolation.
<!--l. 120--></p><p class="indent" >   I suspect this is a sufficiently nettlesome problem that we need to support updates
that allow the value of multiple service identifiers for a single user to be updated in a
single request.
<!--l. 125--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">2.4   </span> <a id="x1-70002.4"></a>Updating the access control permissions</h4>
<!--l. 127--></p><p class="noindent" >Remember how I said that the finger service would just have a two column table? I
lied. Wow, Parkinson&#8217;s law hits really fast.
<!--l. 130--></p><p class="indent" >   Because one of the key issues for a successful finger service is privacy. We don&#8217;t
want stalkers finding people. We don&#8217;t want spammers harvesting identities. We don&#8217;t
want to help the black hats by making it easier to find users with potentially
                                                                  

                                                                  
compromised services. Etc. So we need to expect that the finger service will enforce
access permissions.
<!--l. 136--></p><p class="indent" >   But let&#8217;s think about a simple scenario. Dax has given permission to Martok to
see her calendar in Google. But the utility of that permission will be quite limited if
when Martok&#8217;s calendar application tries to find Dax&#8217;s calendar service the finger
service won&#8217;t accept Martok&#8217;s request to find out where the heck Dax&#8217;s calendar is
at.
<!--l. 142--></p><p class="indent" >   So this argues that when updating data in finger the updater also needs to
provide permission data - who has the user authorized to see this information?
Strictly speaking however this update is more a hint than anything else. In other
words the service is saying &#8221;Look, user X is using me as a calendar service and has
allowed the following users to access their calendar so you should let the following
users also discover where the user&#8217;s calendar is.&#8221;
<!--l. 150--></p><p class="indent" >   This isn&#8217;t nearly as complex as it sounds. The ACL list would literally consist of a
series of email addresses. How those email addresses would be validated is discussed
later.
<!--l. 154--></p><p class="indent" >   And yes sharing all this data with the finger service is more than a little scary.
Plus there are a number of practical issues discussed later in the article that lead me
to believe that the way permissioning will really work is that permissions
will be controlled first and foremost by the user of the finger service on a
&#8217;universal&#8217; basis, e.g. &#8217;anyone in my address book can see where my services are
located&#8217;.
<!--l. 162--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">2.5   </span> <a id="x1-80002.5"></a>Submitting proposed permissions descriptions</h4>
<!--l. 164--></p><p class="noindent" >A problem with sticking a finger service in the middle of everything is that it has
the real potential to slow innovation. For example, let&#8217;s say there is a new
service foo whose service identifier is URN:SomePrivateOrg:Foo. A user
signs up for a foo service and now the foo service wants to update the user&#8217;s
finger service so other users can find the user&#8217;s instance of the foo service.
However when the foo service sends an update to the user&#8217;s finger service
the finger service is likely to reject the request saying &#8221;Huh? What&#8217;s a foo
service?&#8221;
<!--l. 173--></p><p class="indent" >   This is not an unreasonable reaction on the part of the finger service. One can
imagine that a critical part of the update process is when the finger service turns
around to the user and says &#8221;Hey user, I got a request from service X asking to be
your Calendar service, this means that anyone trying to see your free/busy time or
check out your calendar is going to go to service X, are you super duper sure you
want to do this?&#8221;
<!--l. 181--></p><p class="indent" >   But the finger service can&#8217;t provide that level of protection if it&#8217;s dealing with a
service identifier that it doesn&#8217;t recognize.
<!--l. 184--></p><p class="indent" >   I can imagine some ways of trying to tackle this problem, such as having an
industry registry with localized strings where finger services can pick up &#8217;safe&#8217;
descriptions of new services but that&#8217;s a heck of an infrastructure to build and
                                                                  

                                                                  
probably isn&#8217;t going to be available any time soon.
<!--l. 190--></p><p class="indent" >   So I think in the meantime we need to go for the &#8217;user empowering&#8217; (read: we
believe in your inalienable right to commit security suicide) option which is to let the
service that is trying to update the finger directory put in a human readable
description of what the heck the service identifier they are trying to update actually
does. A finger service could then prompt the user &#8221;Dear user, service X wants to
update your service directory with some new service type I don&#8217;t recognize. I have
no idea what the heck this is or what it means and you are pretty much
opening yourself up to eternal security damnation if you agree to this. So
you probably shouldn&#8217;t. But if you care this is what the service claims the
identifier does but hey, they could (and probably are) lying through their
teeth.&#8221;
<!--l. 203--></p><p class="indent" >   Anyone want to take bets on how close to 100% of users will click yes even with
that warning? But that&#8217;s o.k. the <a href="http://www.win.tue.nl/hashclash/rogue-ca/" >little padlock</a> or the <a href="http://www.blackhat.com/presentations/bh-usa-09/SOTIROV/BHUSA09-Sotirov-AttackExtSSL-PAPER.pdf" >green glow</a> will fix everything.
(Was that bitter?)
<!--l. 209--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">3   </span> <a id="x1-90003"></a>Updating the finger service, an example</h3>
<!--l. 211--></p><p class="noindent" >In this example Dax has just signed up with Google&#8217;s calendar service. Dax&#8217;s identity
provider has no relationship with Google. As described <a href="http://www.goland.org/adhocauthentication/" >here</a> Google was able to
authenticate Dax using her identity provider (IdP) even though Google had no
previous relationship with that provider. So the next step is for Google to
send a request to the IdP asking to update Dax&#8217;s finger status. So Google
first asks Dax&#8217;s IdP where the finger update service endpoint is using, well,
finger, obviously. Generally the finger update service endpoint is always
public so no proof of identity was needed (note however that smart IdPs will
return a URL for any submitted user identifier to prevent people fishing
for validate identifiers). Google then sends a request to the finger update
service endpoint asking to update various service identifiers with Dax&#8217;s Google
calendar service URL and also specifying the e-mails of anyone Dax has
approved for access. This will essentially be an OAuth request where Dax will
end up being redirected to her IdP who will confirm that she accepts the
changes. Dax confirms and the changes are made as Dax is redirected back to
Google.
<!--l. 230--></p><p class="indent" >   Note that this entire flow just requires adding some arguments to the
OAuth Web Server flow. It doesn&#8217;t require any fundamentally new protocol
machinery.
<!--l. 235--></p><p class="indent" >   <hr class="figure"/><div class="figure" 
>
                                                                  

                                                                  
<a id="x1-90011"></a>
                                                                  

                                                                  
<!--l. 236--><p class="noindent" >
<object data="managingfingerservice.svg" type="image/svg+xml" width="648.42249pt" height="529.98pt"></object>
<!--tex4ht:graphics  
name="managingfingerservice0x.png" src="0_Users_yarongoland_Documents_Unfinished_Website_Articles_managingfingerservice.eps"  
-->
                                                                  

                                                                  
<br /> <div class="caption" 
><span class="id">Figure&#x00A0;1: </span><span class="content">An example of updating a finger service</span></div><!--tex4ht:label?: x1-90011 -->
                                                                  

                                                                  
<!--l. 242--></p><p class="indent" >   </p></div><hr class="endfigure"/>
   <h4 class="subsectionHead"><span class="titlemark">3.1   </span> <a id="x1-100003.1"></a>Wait a minute, what about the late bound e-mail security hole?</h4>
<!--l. 248--></p><p class="noindent" >The problem, which I&#8217;ve referred to <a href="http://www.goland.org/openpermission/#x1-100003.1" >before</a>, is that email addresses are late bound
identifiers. So if I say &#8221;joe@example.com&#8221; can access my service and at some point
Joe Johnson, who was the person behind joe@example.com, loses that address and
now Joe Jehoshaphat has it, my ACL will still be in place and the wrong person will
have access.
<!--l. 255--></p><p class="indent" >   What we need is a way to exchange a late bound identifier like an email address
with a persistent identifier that is guaranteed to always follow the person and not the
email address. But the infrastructure needed to enable swapping out e-mail addresses
for persistent identifiers should, if we do it right, be implementable on top of the
finger infrastructure. In fact ideally what will be sent across the wire is a list of
doublets, one part identifying an identity provider and the other part a local
identifier.
<!--l. 266--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.2   </span> <a id="x1-110003.2"></a>Isn&#8217;t the list of folks able to see the calendar going to likely be dynamic and
so Google will be endlessly updating the finger permissions?</h4>
<!--l. 268--></p><p class="noindent" >A simple case is that Dax says &#8221;let everyone in my address book see my free/busy
time&#8221; in which case every time someone gets added or removed from Dax&#8217;s copy of
her address book at Google the Google calendar service will need to go over to Dax&#8217;s
finger service and update the list of folks who can discover her calendar service in the
first place.
<!--l. 275--></p><p class="indent" >   One solution is to just ask Google. In other words somebody shows up with a
request to Dax&#8217;s finger service asking to see where Dax&#8217;s calendar is located. The
Finger service knows that Dax has her personal calendar at Google and let&#8217;s say her
work calendar at Exchange Online. Dax&#8217;s finger service could fire off two requests to
each service asking &#8221;Hey, should I let this person see Dax&#8217;s calendar service
location?&#8221;
<!--l. 282--></p><p class="indent" >   This approach however does have a few problems. First, it&#8217;s very prone to leak
data. An attacker can see where connections are going from the finger service and
make a pretty good guess about things like &#8221;Hey, there is a user called Dax&#8221; and then
&#8221;Oh and that user probably uses Google and Exchange&#8221;. So much for privacy. The
performance is also likely to be less than one might like since every incoming
request ends up resulting in one or more outgoing requests before it can be
answered.
<!--l. 291--></p><p class="indent" >   My suspicion is that in practice this problem doesn&#8217;t really need to be solved. My
suspicion is that the way users will really manage their finger service is they will say
things like &#8221;Anyone in my address book can see my services&#8221;, their finger
service will be syncing to where ever their address book is kept and call
it a day. They will have the choice of making more restricted settings but
in the general case I think just having that level of validation is probably
                                                                  

                                                                  
enough.
<!--l. 300--></p><p class="indent" >   Keep in mind that finger services that are associated with corporate identities will
almost certainly be backed by full directories who can play all the access control
tricks one could ever want. For those kind of customers I expect that services will
either synch the full directory contents (including groups, rules, etc.) or really will
outsource requests to the corporate directory.
<!--l. 307--></p><p class="indent" >   In other words if someone is using Google Apps through their company then
when someone tries to access one of the employee&#8217;s Google Apps accounts
Google will forward the request to the corporation for fulfillment or will
fulfill it with a local copy of the corporation&#8217;s directory. This approach is
acceptable because the corporations pay enough money to make it economically
feasible.
<!--l. 316--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.3   </span> <a id="x1-120003.3"></a>Does telling the requester about additional identifiers associated with the
service open up a possible security hole?</h4>
<!--l. 318--></p><p class="noindent" >Possibly. It&#8217;s a trade off. I suspect this trade off will have to be made depending on
the nature of the identifier being updated.
<!--l. 322--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.4   </span> <a id="x1-130003.4"></a>Why couldn&#8217;t Google just ask for two identifiers in one request?</h4>
<!--l. 324--></p><p class="noindent" >Because if we do that we are essentially tunneling an application protocol inside of an
application protocol. We need to create a compound wrapper to contain each of the
individual requests and quite possibly a compound response format (assuming the
semantics are not all or nothing which I think would be odd in our case). That is a
lot of complexity to save a round trip.
<!--l. 332--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.5   </span> <a id="x1-140003.5"></a>Oh come on, why isn&#8217;t this just LDAP?</h4>
<!--l. 334--></p><p class="noindent" >ASN.1 in the browser? Sounds like fun. And what a wonderful barrier to entry for
anyone wanting to run their finger service. &#8221;Step 1, LDAP&#8221;. I doubt anyone will make
it to step 2. LDAP is wonderfully successful but only in places where the price is
worth the reward (e.g. the enterprise).
<!--l. 341--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.6   </span> <a id="x1-150003.6"></a>Fine, if it&#8217;s not LDAP then why isn&#8217;t it WebDAV?</h4>
<!--l. 343--></p><p class="noindent" >Hum... resources... properties.... named retrieval.... updates.... I&#8217;ve seen this story
before. It was called WebDAV. And no whining about how to run WebDAV in the
browser since XMLHTTP was literally invented for WebDAV. My current desire is to
see finger folded into the OAuth 2.0 world and so I&#8217;d like to see a solution that is in
                                                                  

                                                                  
keeping with how OAuth 2.0 works. This would be something much simpler than
WebDAV. But once the standards machinery is done who knows where we end
up.
<a id="Q1-1-17"></a></p></div></p>]]></content:encoded>
			<wfw:commentRss>http://www.goland.org/managingfingerservice/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using OAuth WRAP and Finger for ad-hoc user authentication</title>
		<link>http://www.goland.org/adhocauthentication/</link>
		<comments>http://www.goland.org/adhocauthentication/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 00:26:17 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[SOA/Web/Etc.]]></category>

		<guid isPermaLink="false">http://www.goland.org/?p=761</guid>
		<description><![CDATA[The OpenID community has worked long and hard to make ad-hoc logins possible on the web. Part of that process has been experiments with a number of different technologies and approaches. Below I make my own proposal for how to handle ad-hoc logins on the Internet using OAuth WRAP and my own spin on Finger. [...]]]></description>
			<content:encoded><![CDATA[     <!--l. 32--><p class="indent" >    <span class="aer-9">The </span><a href="http://openid.net/" ><span class="aer-9">OpenID</span></a> <span class="aer-9">community has worked long and hard to make ad-hoc</span>
     <span class="aer-9">logins possible on the web. Part of that process has been experiments with</span>
     <span class="aer-9">a number of different technologies and approaches. Below I make my own</span>
     <span class="aer-9">proposal for how to handle ad-hoc logins on the Internet using OAuth</span>
     <span class="aer-9">WRAP and my own </span><a href="http://www.goland.org/simplewebfinger/" ><span class="aer-9">spin</span></a> <span class="aer-9">on Finger. I offer this up as food for thought.</span>
<span id="more-761"></span>
       <h3 class="likesectionHead"><a id="x1-1000"></a><span class="aer-9">Contents</span></h3>
       <div class="tableofcontents">
       <span class="sectionToc" ><span class="aer-9">1 </span><a href="#x1-20001" id="QQ2-1-2"><span class="aer-9">Disclaimer</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">2 </span><a href="#x1-30002" id="QQ2-1-3"><span class="aer-9">Logging into the Foo service - a scenario</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">3 </span><a href="#x1-40003" id="QQ2-1-4"><span class="aer-9">My thoughts on requirements</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.1 </span><a href="#x1-50003.1" id="QQ2-1-5"><span class="aer-9">No federation, no registration, it&#8217;s truly ad-hoc</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.2 </span><a href="#x1-60003.2" id="QQ2-1-6"><span class="aer-9">No public key encryption beyond SSL/TLS, at least not initially</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">4 </span><a href="#x1-70004" id="QQ2-1-7"><span class="aer-9">An example</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.1 </span><a href="#x1-80004.1" id="QQ2-1-9"><span class="aer-9">What if Joe&#8217;s identity provider isn&#8217;t the same as his domain name?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.2 </span><a href="#x1-90004.2" id="QQ2-1-10"><span class="aer-9">Why do we need proof1 in messages 4 and 6? Shouldn&#8217;t the request ID be enough?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.3 </span><a href="#x1-100004.3" id="QQ2-1-11"><span class="aer-9">How did Example.com know what security token format to send</span>
     <span class="aer-9">proof of Joe&#8217;s identity in to the Foo service or what claims to use?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.4 </span><a href="#x1-110004.4" id="QQ2-1-12"><span class="aer-9">Wouldn&#8217;t it be easier for the Foo service to just make one directory</span>
     <span class="aer-9">lookup request against example.com instead of two?</span></a></span>
                                                                  

                                                                  
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.5 </span><a href="#x1-120004.5" id="QQ2-1-13"><span class="aer-9">Why is Example.com using finger in 5/5R to find Foo&#8217;s key negotiation</span>
     <span class="aer-9">service URL when that value was already provided in message 4?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.6 </span><a href="#x1-130004.6" id="QQ2-1-14"><span class="aer-9">How do keys expire and get replaced?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.7 </span><a href="#x1-140004.7" id="QQ2-1-15"><span class="aer-9">What happens if a key gets compromised or lost?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.8 </span><a href="#x1-150004.8" id="QQ2-1-16"><span class="aer-9">Aren&#8217;t there race conditions between two services trying to establish keys?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.9 </span><a href="#x1-160004.9" id="QQ2-1-17"><span class="aer-9">Does Foo service repeat this entire process with everyone from</span>
     <span class="aer-9">example.com who wants to login?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.10 </span><a href="#x1-170004.10" id="QQ2-1-18"><span class="aer-9">Why do we need to discover the location of the key negotiation or</span>
     <span class="aer-9">login services? Why not just hard code their locations under /.well-known?</span></a></span>
       </div>

<!--l. 42--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">1   </span> <a id="x1-20001"></a>Disclaimer</h3>
<!--l. 44--></p><p class="noindent" >My employer has nothing to do with anything in this article. They didn&#8217;t review
it, authorize it or influence it. It&#8217;s my ideas and my ideas alone. So blame
me.
<!--l. 48--></p><p class="indent" >   I have a deep interest in identity issues mostly as part of my fervent desire to live
in an Open Web and that web doesn&#8217;t exist today. So I ask the reader to please take
these ideas in the spirit that they are offered, as a fellow traveler trying to find
a successful path to a web where users decide who they want to interact
with.
<!--l. 55--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">2   </span> <a id="x1-30002"></a>Logging into the Foo service - a scenario</h3>
<!--l. 57--></p><p class="noindent" >Joe wants to use the Foo service. To do this Joe needs to log into the Foo service.
Joe&#8217;s identity provider is example.com where Joe is known as joe@example.com. The
Foo service and example.com have no previous relationship. Joe tells the Foo service
that his email is joe@example.com (note: the scenario works just as well with
just Joe&#8217;s domain so there is no need to expose one&#8217;s identity). The Foo
service then uses finger (my thoughts on which I have explored <a href="http://www.goland.org/simplewebfinger/" >here</a>) to obtain
example.com&#8217;s symmetric key negotiation service and login service endpoints. The
Foo service uses the key negotiation service to negotiate a symmetric key
with example.com. Then the Foo service uses a profile of OAuth WRAP
to forward Joe to the login service asking for proof that the user really is
joe@example.com. Example.com validates Joe&#8217;s identity and then forwards Joe&#8217;s web
browser back to the Foo service with a security token attesting to Joe&#8217;s
identity.
                                                                  

                                                                  
<!--l. 73--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">3   </span> <a id="x1-40003"></a>My thoughts on requirements</h3>
<!--l. 76--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.1   </span> <a id="x1-50003.1"></a>No federation, no registration, it&#8217;s truly ad-hoc</h4>
<!--l. 78--></p><p class="noindent" >We need an approach to authenticating users across services that doesn&#8217;t require the
services to have any pre-existing relationship. The services must not need to register
with each other, federate or any other &#8217;off line&#8217; magic in order to successfully
authenticate users to each other.
<!--l. 84--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.2   </span> <a id="x1-60003.2"></a>No public key encryption beyond SSL/TLS, at least not initially</h4>
<!--l. 86--></p><p class="noindent" >The use of public key encryption has obvious applications to this scenario. But I
believe we have to start simple with solutions that do not require any form of PKI
beyond SSL/TLS which I believe should be mandatory requirements of the protocol.
Yes, in the future, we definitely should extend to PKI because it has some
very nice advantages but I believe that the base functionality shouldn&#8217;t use
anything more than SSL/TLS with some HMAC thrown in for validation of
security tokens. Note however that support for SSL/TLS is mandatory and a
critical component of the security of the key negotiation algorithm defined
below.
<!--l. 98--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">4   </span> <a id="x1-70004"></a>An example</h3>
<!--l. 100--></p><p class="noindent" >When Joe first navigates to the Foo service he is prompted to login. Ideally Joe
should just type in his identity provider&#8217;s domain name (example.com) but
realistically most users won&#8217;t &#8217;get&#8217; that (at least not initially) and will probably just
type in their e-mail addresses, in this case, joe@example.com.
<!--l. 106--></p><p class="indent" >   The Foo service has never had an interaction with example.com before so the first
thing it does is do a lookup on example.com&#8217;s <a href="http://www.goland.org/simplewebfinger/" >finger service</a> to find the location of
example.com&#8217;s key negotiation endpoint. This process consists of sending a POST
request to https://example.com/.well-known/finger-service?service=example.com with a
scope (a la OAuth WRAP) of URN:SomeStandardsOrgId:KeyNegotiationService. The
response would contain a URL such as https://example.com/keynegotiationservice.
<!--l. 113--></p><p class="indent" >   The Foo service would then send a request to establish a symmetric key to
https://example.com/keynegotiationservice. The request would contain Foo&#8217;s key
negotiation service URL (https://foo.com/mykeygenerator), a request ID
and a cryptographically secure randomly generated number that I&#8217;ll call
proof1.
<!--l. 119--></p><p class="indent" >   Example.com would then double check the key negotiation service location by
using a finger request on foo.com to find foo.com&#8217;s key negotiation endpoint. Once
                                                                  

                                                                  
it had validated that the URL it received in the key negotiation request
matched the value retrieved from finger then example.com would issue a
POST to that URL with the request ID, proof1 and a symmetric key value
that is to be used to sign security tokens between example.com and the Foo
service.
<!--l. 127--></p><p class="indent" >   At this point there is now a symmetric key that both Example.com and the Foo
service (represented by the domain foo.com) have agreed to use with each
other.
<!--l. 131--></p><p class="indent" >   Now the Foo service will perform a second finger lookup but this time look for
URN:SomeStandardsOrgId:LoginService. This time the Foo service wants to know
where to send Joe in order to log him in.
<!--l. 135--></p><p class="indent" >   Foo service will then forward Joe&#8217;s browser to the URI returned in the previous
finger request along with an OAuth WRAP style permission request of &#8221;Please log
this person in and tell me who the heck they are.&#8221;
<!--l. 140--></p><p class="indent" >   Example.com will then log Joe in and ask Joe if he wants to tell Foo service
who he is. Joe will say yes and Example.com will redirect Joe back to Foo
service with a security token, HMAC&#8217;d with the shared key, asserting Joe&#8217;s
identity.
<!--l. 145--></p><p class="indent" >   And now we&#8217;re done. Joe logged into Foo service using his identity provider
example.com even though Foo service and example.com had never had any previous
interactions with each other.
<!--l. 150--></p><p class="indent" >   <hr class="figure"/><div class="figure" 
>
                                                                  

                                                                  
<a id="x1-70011"></a>
                                                                  

                                                                  
                                                                  

                                                                  
<!--l. 151--><p class="noindent" >
<object data="adhocauthentication.svg" type="image/svg+xml" width="1350pt" height="630pt"></object>
<!--tex4ht:graphics  
name="adhocauthentication0x.png" src="4_Users_yarongoland_Documents_BlogXMLRPC_src_technology_soawebetc_adhocauthentication.eps"  
-->
<br /> <div class="caption" 
><span class="id">Figure&#x00A0;1: </span><span class="content">An example of ad hoc authentication</span></div><!--tex4ht:label?: x1-70011 -->
                                                                  

                                                                  
<!--l. 157--></p><p class="indent" >   </p></div><hr class="endfigure"/>
<!--l. 160--></p><p class="indent" >   Only the colored links involve standardization. The blue links (3/3R, 5/5R and
7/7R) use finger whose design I have discussed <a href="http://www.goland.org/simplewebfinger/" >elsewhere</a>. The green links (4/4R and
6/6R) are the symmetric key negotiation algorithm I introduce in this article. The
red links (2R, 8, 9R and 10) are a minor profile of OAuth WRAP that I discuss in
this article.
   <h4 class="subsectionHead"><span class="titlemark">4.1   </span> <a id="x1-80004.1"></a>What if Joe&#8217;s identity provider isn&#8217;t the same as his domain name?</h4>
<!--l. 169--></p><p class="noindent" >This is actually not an uncommon situation. For example, users establish Facebook
accounts with e-mail addresses that Facebook doesn&#8217;t own yet Facebook acts very
much as an identity provider. Some services, like Google and Live are identity
providers where users can either choose to use a domain for their e-mail
controlled by Google or Live (e.g. gmail.com or live.com) or they can use an
existing e-mail address. This can sometimes create confusion. If Joe has a Live
account he created with the e-mail address joe@example.com and Joe wants to
login to the Foo service then if he says his e-mail is joe@example.com the
Foo service will go to example.com instead of live.com who is Joe&#8217;s identity
provider.
<!--l. 181--></p><p class="indent" >   This is a really sticky problem and I&#8217;m pretty convinced that it&#8217;s not interesting
to solve. The reason identity providers like Live or Google let users use existing
e-mail addresses from domains not owned by identity provider was as a
convenience. That convenience is proving more and more troublesome to
the point where the message needs to go out - login using your identity
provider. So if Joe wants to be known as joe@example.com then example.com
better be his identity provider. Otherwise he needs to get another e-mail
address.
<!--l. 190--></p><p class="indent" >   I know many people don&#8217;t find this to be a satisfying answer but I believe that
bending ourselves over backwards to solve a weird pointer problem just isn&#8217;t worth
the effort.
<!--l. 196--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.2   </span> <a id="x1-90004.2"></a>Why do we need proof1 in messages 4 and 6? Shouldn&#8217;t the request ID be
enough?</h4>
<!--l. 198--></p><p class="noindent" >As long as the request ID contains a cryptographically secure random number of
sufficient length then yes it is enough. But I felt like calling out the requirement for
the secure value as its own value in the exchange in order to hammer home
how important it is from a security perspective. The security of the key
establishment hinges on the use of TLS/SSL and the exchange of an unguessable
secret. If either is compromised then the key establishment protocol is not
secure.
                                                                  

                                                                  
<!--l. 208--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.3   </span> <a id="x1-100004.3"></a>How did Example.com know what security token format to send proof of
Joe&#8217;s identity in to the Foo service or what claims to use?</h4>
<!--l. 210--></p><p class="noindent" >My assumption is that we will define profiles for common situations like this. So there
will be a profile called &#8217;login&#8217; and that profile will specify things like what
security token format to use and what claims can be placed in that security
token.
<!--l. 217--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.4   </span> <a id="x1-110004.4"></a>Wouldn&#8217;t it be easier for the Foo service to just make one directory lookup
request against example.com instead of two?</h4>
<!--l. 219--></p><p class="noindent" >This is really more of an issue for the <a href="http://www.goland.org/simplewebfinger/" >finger server article</a> but my opinion is that with
HTTP/1.1 pipelining (and in this case the POST&#8217;s semantics are idempotent so
pipelining is fine) I don&#8217;t see any reason to over optimize. Besides these requests
should be reasonably rare.
<!--l. 227--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.5   </span> <a id="x1-120004.5"></a>Why is Example.com using finger in 5/5R to find Foo&#8217;s key negotiation
service URL when that value was already provided in message 4?</h4>
<!--l. 229--></p><p class="noindent" >In theory any request that can be validated against a domain over TLS/SSL should
be &#8217;trusted&#8217; as having properly come from that domain. But in practice
paranoia is a healthy thing. Let&#8217;s say an attacker has managed to take over
some small part of example.com and is using that to launch key attacks. By
checking the key negotiation service location in message 4 against the value
returned by the finger service in 5R, example.com gives itself an extra level of
protection.
<!--l. 238--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.6   </span> <a id="x1-130004.6"></a>How do keys expire and get replaced?</h4>
<!--l. 240--></p><p class="noindent" >As part of the key exchange one expects that an expiration date will be associated
with the key. To keep things running smoothly it will be necessary to be able to roll
keys over without a &#8217;gap&#8217; where no key is in place. This means that at a minimum
the two parties to a key negotiation need to handle having at least two keys active at
the same time.
<!--l. 247--></p><p class="indent" >   For example, let&#8217;s say a key has been negotiated and will expire in a few days.
One of the parties may decide it is time to create a new key so that it can be
established before the old key expires. For this scheme to work at least two keys have
to be active at the same time, the old key that is about to expire and the newly
established key.
<!--l. 254--></p><p class="indent" >   In general a new key is established any time the key negotiation exchange is
made. So in theory an unbounded number of keys could be put into play. In practice
however each side is likely to have some upper limit to how many keys they want in
                                                                  

                                                                  
play at any one time. This limit can be enforced either by refusing to add new keys
if there already exist a maximum number of unexpired keys or dropping
off an existing key (e.g. no longer honoring it) if the maximum number of
supported keys has been reached. Which approach isn&#8217;t as important as making
sure both ends of the conversation understand what has happened. My own
preference is for each side to just support a maximum number of keys and to
refuse to create new ones if that maximum is filled with unexpired keys.
I think the failure scenarios for that situation are easier for each side to
understand.
<!--l. 269--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.7   </span> <a id="x1-140004.7"></a>What happens if a key gets compromised or lost?</h4>
<!--l. 271--></p><p class="noindent" >My own thinking is that the key negotiation protocol should have a message
exchange type of &#8221;Delete all keys we have negotiated&#8221; along with a human description
of what the heck happened and some contact information since a follow up is
probably necessary. This exchange would occur using the same two step pattern as
establishing a key so as to prevent attacks.
<!--l. 280--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.8   </span> <a id="x1-150004.8"></a>Aren&#8217;t there race conditions between two services trying to establish
keys?</h4>
<!--l. 282--></p><p class="noindent" >You betcha. Imagine a case where a user is logging into one of example.com&#8217;s services
using a Foo service identity and vice versa. This could easily result in two different
keys getting established between the same services. But as long as we mandate that
each side be able to handle a reasonable number of keys (say 10 just to pick some
integer) then it really shouldn&#8217;t matter.
<!--l. 291--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.9   </span> <a id="x1-160004.9"></a>Does Foo service repeat this entire process with everyone from example.com
who wants to login?</h4>
<!--l. 293--></p><p class="noindent" >Heck no. The negotiated key is good for all communications between foo.com and
example.com
<!--l. 298--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.10   </span> <a id="x1-170004.10"></a>Why do we need to discover the location of the key negotiation or login
services? Why not just hard code their locations under /.well-known?</h4>
<!--l. 300--></p><p class="noindent" >Somewhere I can hear Mark Nottingham groaning. Strictly speaking hard coding the
locations under /.well-known is at least logically consistent. But in general hard
coding makes for fragile systems. It limits implementers flexibility around where
services should be hosted. So it seems like a good idea to hard code as few things as
                                                                  

                                                                  
possible and let everything else be dynamic. Hence the desire to redirect through a
finger server.
<a id="Q1-1-19"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.goland.org/adhocauthentication/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Thoughts on building a finger service</title>
		<link>http://www.goland.org/simplewebfinger/</link>
		<comments>http://www.goland.org/simplewebfinger/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 00:47:09 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[SOA/Web/Etc.]]></category>

		<guid isPermaLink="false">http://www.goland.org/?p=754</guid>
		<description><![CDATA[Those folks of a certain age will remember the finger command/protocol which allowed one to look up information about a person based just on their login identifier. This command was extremely useful even if it had some troubling security and privacy implications. Efforts are underway to create a Web Finger but for reasons I&#8217;ve previously [...]]]></description>
			<content:encoded><![CDATA[     <!--l. 32--><p class="indent" >    <span class="aer-9">Those            folks            of            a            certain            age</span>
     <span class="aer-9">will remember the </span><a href="http://en.wikipedia.org/wiki/Finger_protocol" ><span class="aer-9">finger</span></a> <span class="aer-9">command/protocol which allowed one to look</span>
     <span class="aer-9">up information about a person based just on their login identifier. This</span>
     <span class="aer-9">command was extremely useful even if it had some troubling security and</span>
     <span class="aer-9">privacy implications. Efforts are underway to create a </span><a href="http://code.google.com/p/webfinger/" ><span class="aer-9">Web Finger</span></a> <span class="aer-9">but for</span>
     <span class="aer-9">reasons I&#8217;ve </span><a href="http://www.goland.org/openpermission/#x1-110003.2" ><span class="aer-9">previously discussed</span></a> <span class="aer-9">I think the underlying technologies for</span>
     <span class="aer-9">those efforts are sub-optimal. So in this article I propose what I think is a</span>
     <span class="aer-9">much simpler approach. My motivation for caring is that I think having a</span>
     <span class="aer-9">finger service will make permissioning systems much more useful (see </span><a href="http://www.goland.org/openpermission/" ><span class="aer-9">here</span></a>
     <span class="aer-9">and </span><a href="http://www.goland.org/oauthpermissioningexamples/" ><span class="aer-9">here</span></a><span class="aer-9">).</span>
<span id="more-754"></span>
       <h3 class="likesectionHead"><a id="x1-1000"></a><span class="aer-9">Contents</span></h3>
       <div class="tableofcontents">
       <span class="sectionToc" ><span class="aer-9">1 </span><a href="#x1-20001" id="QQ2-1-2"><span class="aer-9">Disclaimer</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">2 </span><a href="#x1-30002" id="QQ2-1-3"><span class="aer-9">Scenario - discovering a friend&#8217;s calendar service using a local application</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">3 </span><a href="#x1-40003" id="QQ2-1-4"><span class="aer-9">My personal opinions on requirements</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.1 </span><a href="#x1-50003.1" id="QQ2-1-5"><span class="aer-9">The finger service should just point at other services</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.2 </span><a href="#x1-60003.2" id="QQ2-1-6"><span class="aer-9">The finger service needs to support authentication and authorization</span>
     <span class="aer-9">to control who gets to see what</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.3 </span><a href="#x1-70003.3" id="QQ2-1-7"><span class="aer-9">The finger service should just be a service, not a document</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.4 </span><a href="#x1-80003.4" id="QQ2-1-8"><span class="aer-9">The finger service should start with trivial queries and get complex later</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.5 </span><a href="#x1-90003.5" id="QQ2-1-9"><span class="aer-9">The finger service should at least support using e-mail addresses as user identifiers</span></a></span>
                                                                  

                                                                  
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.6 </span><a href="#x1-100003.6" id="QQ2-1-10"><span class="aer-9">The finger service should use HTTP, in preference to DNS, to go</span>
     <span class="aer-9">from e-mail to finger service</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.7 </span><a href="#x1-110003.7" id="QQ2-1-11"><span class="aer-9">The finger service should use SSL/TLS when dealing with non-anonymous</span>
     <span class="aer-9">queries/responses</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">4 </span><a href="#x1-120004" id="QQ2-1-12"><span class="aer-9">Martok gets Dax&#8217;s free/busy time - An example</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.1 </span><a href="#x1-130004.1" id="QQ2-1-14"><span class="aer-9">Where did the refresh token in message 1 come from?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.2 </span><a href="#x1-140004.2" id="QQ2-1-15"><span class="aer-9">How can the access token from 1R be used both in message 2 and message 5?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.3 </span><a href="#x1-150004.3" id="QQ2-1-16"><span class="aer-9">Well then, why couldn&#8217;t the access token from 3R be used with request 6?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.4 </span><a href="#x1-160004.4" id="QQ2-1-17"><span class="aer-9">Wait, remind me again, how did Martok&#8217;s calendar client know where</span>
     <span class="aer-9">Dax&#8217;s finger service was?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.5 </span><a href="#x1-170004.5" id="QQ2-1-18"><span class="aer-9">Why do we bother with the previously mentioned STS/Kerberos two step anyway?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.6 </span><a href="#x1-180004.6" id="QQ2-1-19"><span class="aer-9">How did Martok get permission to access Dax&#8217;s finger service or free/busy time?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.7 </span><a href="#x1-190004.7" id="QQ2-1-20"><span class="aer-9">How did Martok&#8217;s identity provider know how to issue security tokens</span>
     <span class="aer-9">with formats and claims supported by Dax&#8217;s finger service and calendar service?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.8 </span><a href="#x1-200004.8" id="QQ2-1-21"><span class="aer-9">Couldn&#8217;t Dax&#8217;s finger server tell Dax&#8217;s calendar server that Martok</span>
     <span class="aer-9">is allowed to have access to free/busy time?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">4.9 </span><a href="#x1-210004.9" id="QQ2-1-22"><span class="aer-9">Couldn&#8217;t Dax have multiple calendar services?</span></a></span>
       </div>

<!--l. 47--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">1   </span> <a id="x1-20001"></a>Disclaimer</h3>
<!--l. 49--></p><p class="noindent" >I don&#8217;t always remember to put on a disclaimer because this is my blog
and my opinions and by default the assumption should be that anything
I say here represents my views and only my views. But just in case, this
article (like all the articles on my blog) represents my views and only my
views.
<!--l. 57--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">2   </span> <a id="x1-30002"></a>Scenario - discovering a friend&#8217;s calendar service using a local application</h3>
<!--l. 59--></p><p class="noindent" >Martok wants to invite Dax to a meeting but to do so Martok needs to see Dax&#8217;s
free/busy time which is available at Dax&#8217;s calendar service. But Martok
doesn&#8217;t know which calendar service Dax uses. So Martok uses the finger
functionality from inside of his local calendaring client to take Dax&#8217;s e-mail address
and use it to discover Dax&#8217;s finger service. Martok then authenticates to
Dax&#8217;s finger service and queries for Dax&#8217;s calendar. Dax&#8217;s finger service has
been instructed to share details such as Dax&#8217;s calendar service location with
anyone who is part of Dax&#8217;s personal address book. Since Martok is in Dax&#8217;s
personal address book he is allowed to see where Dax&#8217;s calendar service is
kept.
                                                                  

                                                                  
<!--l. 71--></p><p class="indent" >   Note: This scenario is strictly about programmatic interaction with the finger
service. I&#8217;ll leave UX issues for another day.
<!--l. 75--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">3   </span> <a id="x1-40003"></a>My personal opinions on requirements</h3>
<!--l. 78--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.1   </span> <a id="x1-50003.1"></a>The finger service should just point at other services</h4>
<!--l. 80--></p><p class="noindent" >Once upon a time finger directly returned key information about the user
such as their office location or status message. But in the new world order
with social networks all over the place it seems more reasonable to think
about finger as a catalog of pointers to more specialized services. In other
words one shouldn&#8217;t go to Finger to find out someone&#8217;s status. One should
rather go to Finger to find out what service or services a user uses to publish
their status (Messenger? Facebook? Twitter?). The same thing with other
services such as blogs (personal or work?), calendars, preferred social network,
etc.
<!--l. 92--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.2   </span> <a id="x1-60003.2"></a>The finger service needs to support authentication and authorization to
control who gets to see what</h4>
<!--l. 94--></p><p class="noindent" >Because of the privacy and security implications of finger it&#8217;s necessary to
authenticate who is requesting information (even if the authentication is just
&#8217;anonymous&#8217;) and to require the requester to specify exactly what information they
want. This allows the finger service to reason about who is making the request and
what they want and so decide what is appropriate to share.
<!--l. 101--></p><p class="indent" >   It&#8217;s tempting to argue that it isn&#8217;t necessary to know what the requester wants
since who they are should specify what they can see. But I believe that as a rule it&#8217;s
not a good idea to over share.
<!--l. 106--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.3   </span> <a id="x1-70003.3"></a>The finger service should just be a service, not a document</h4>
<!--l. 108--></p><p class="noindent" >I have <a href="http://www.goland.org/openpermission/#x1-110003.2" >previously</a> explained my concerns about the XRD/LRDD approach to finger.
So I won&#8217;t repeat myself here other than to say - I believe finger is a service not a
document. So I expect that people will issue queries to the finger service and get back
responses, not just do global GETs.
                                                                  

                                                                  
<!--l. 116--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.4   </span> <a id="x1-80003.4"></a>The finger service should start with trivial queries and get complex
later</h4>
<!--l. 118--></p><p class="noindent" >At its heart the finger service is a database with ACLs on top. So one could imagine
specifying that the interface for the finger service should be something like <a href="http://www.odata.org/" >OData</a>. I
actually expect that eventually finger services will sport interfaces like OData
because they will make potentially interesting query and data navigation capabilities
possible.
<!--l. 125--></p><p class="indent" >   But in the short run I think we need to focus on easy things first. If all we do
initially is just create an interface where someone can submit an identifier of a service
and get back what, if anything, the finger service is willing to say about that the
user&#8217;s usage of that service then we will have done a good thing for the
world.
<!--l. 133--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.5   </span> <a id="x1-90003.5"></a>The finger service should at least support using e-mail addresses as user
identifiers</h4>
<!--l. 135--></p><p class="noindent" >A perennial argument about how to identify users is what kind of identifier should be
used? Whatever that identifier is it has to be something that enables a finger client to
go from that identifier to the finger service that handles that identifier. Similarly the
identifier needs to be something that is easy for users to remember and exchange.
Something that is easily transcribable and typeable so users can just type a friend&#8217;s
identifier into an application or service and away they go. To date there is exactly one
user identifier that has proven robust across all of these requirements - e-mail
addresses. So email addresses are a minimum required user identifier. This
means that the finger service has to define how to find the finger service for a
particular individual by starting off with nothing more than their e-mail
address.
<!--l. 150--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.6   </span> <a id="x1-100003.6"></a>The finger service should use HTTP, in preference to DNS, to go from
e-mail to finger service</h4>
<!--l. 152--></p><p class="noindent" >Going from an e-mail address to the finger service that owns that address essentially
requires figuring out how to use the DNS name in the e-mail address to find the
finger service. One obvious way to do this would be DNS <a href="http://tools.ietf.org/html/rfc2782" >SRV</a> records. We could add
a new SRV type for finger services and allow discovery that way. The downside
to this approach is that it requires the ability to manipulate DNS records
on the server side and the ability to make DNS queries on the client side.
Neither is a common operation for most programmers or users. So basing
discovering on DNS is likely to slow adoption. Nothing stops us from adding an
extension based on DNS but I personally don&#8217;t think that it is the right place to
start.
<!--l. 165--></p><p class="indent" >   Instead I think we should build on top of <a href="http://tools.ietf.org/html/rfc5785" >RFC 5785</a> that defines a location
                                                                  

                                                                  
for hosting &#8217;well known&#8217; services via HTTP. So if someone has the e-mail
address joe@example.com they could try to find the finger service for Joe at

http://example.com/.well-known/finger-service.

<!--l. 170--></p><p class="indent" >   There are some pretty obvious problems with this approach. For example, what
happens if the owner of one&#8217;s e-mail domain doesn&#8217;t support the finger service? Is one
supposed to change one&#8217;s e-mail address just to get to a service provider who does
support the finger service? The answer, I believe, is, unfortunately, yes. It&#8217;s the
nature of hierarchical trust systems that there are choke points, in this case, the
domain owner. We could look for a web of trust system but previous experience
with systems like <a href="http://www.gnupg.org/" >GPG</a> teach that while these systems can be powerful they
are hard for users to understand so I don&#8217;t feel they are a good starting
point.
<!--l. 181--></p><p class="indent" >   Nevertheless the RFC 5785 approach does offer flexibility. For example, let&#8217;s
say I don&#8217;t want to host my own finger service but I do own goland.org. I
can easily set up a redirect rule in my domain to redirect requests for
http://goland.org/.well-known/finger-service to where ever my finger service actually
rests. I would posit that more people know how to set up redirect rules then know
how to configure SRV records.
<!--l. 190--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.7   </span> <a id="x1-110003.7"></a>The finger service should use SSL/TLS when dealing with non-anonymous
queries/responses</h4>
<!--l. 192--></p><p class="noindent" >Any finger service that needs to support authorization/authentication (and one hopes
that is the majority) must support SSL/TLS. The OAuth 1.0 signature/encryption
experience has taught that adding message integrity/confidentiality as a layer on top
of protocols like HTTP is so difficult as to be impractical for even sophisticated
developers. So rather than re-invent the wheel we&#8217;ll require using the one that&#8217;s
already there, SSL/TLS.
<!--l. 200--></p><p class="indent" >   Note: The reader is well advised to review articles <a href="http://www.crypto.com/blog/spycerts/" >such as this one</a> that explain
some fundamental flaws in how SSL is used operationally. The way certs are used
today enables abuse and I think this is much more threatening in the long run then
functional flaws like the <a href="http://www.educatedguesswork.org/2009/11/understanding_the_tls_renegoti.html" >renegotiation attack</a> for which <a href="http://tools.ietf.org/html/draft-mrex-tls-secure-renegotiation" >a fix</a> is likely to be available
sooner rather than later.
<!--l. 208--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">4   </span> <a id="x1-120004"></a>Martok gets Dax&#8217;s free/busy time - An example</h3>
<!--l. 210--></p><p class="noindent" >In this example Martok&#8217;s calendar client is going to start with Dax&#8217;s e-mail address
and use it to go to the reserved URL for the finger service and ask for Dax&#8217;s calendar
location. Embedded in the request is a security token authenticating Martok to Dax&#8217;s
finger service. For right now I&#8217;ll just wave my hands and say that Dax&#8217;s finger
service is federated with Martok&#8217;s Identity Provider and so recognizes the
HMAC/signature/etc. on the security token. In a later article I&#8217;ll explain how we can
                                                                  

                                                                  
build on top of the finger service to enable ad-hoc authentication of users without
federation.
<!--l. 220--></p><p class="indent" >   Dax&#8217;s finger service will validate Martok&#8217;s security token and return the location
of Dax&#8217;s calendar service. Martok&#8217;s calendar client will then get a security token for
Dax&#8217;s calendar service and use that to access Dax&#8217;s free/busy time. Again, I&#8217;m going
to assume that Martok&#8217;s Identity Provider is also federated with Dax&#8217;s calendar
service.
<!--l. 226--></p><p class="indent" >   Note: To keep the picture from getting too big I have collapsed the services and
their associated authentication servers into a single box.
<!--l. 231--></p><p class="indent" >   <hr class="figure"/><div class="figure" 
>
                                                                  

                                                                  
<a id="x1-120011"></a>
                                                                  

                                                                  
                                                                  

                                                                  
<!--l. 232--><p class="noindent" ><object data="MartokDaxFreeBusy.svg" type="image/svg+xml" width="799.98874pt" height="746.79pt" ></object><!--tex4ht:graphics  
name="simplewebfinger0x.png" src="1_Users_yarongoland_Documents_BlogXMLRPC_src_technology_soawebetc_MartokDaxFreeBusy.eps"  
-->
<br /> <div class="caption" 
><span class="id">Figure&#x00A0;1: </span><span class="content">Martok gets Dax&#8217;s free/busy time</span></div><!--tex4ht:label?: x1-120011 -->
                                                                  

                                                                  
<!--l. 238--></p><p class="indent" >   </p></div><hr class="endfigure"/>
<!--l. 241--></p><p class="indent" >   This picture is essentially the STS/Kerberos two step repeated over and over
again. Martok&#8217;s client gets an access token from the identity provider which is
provided to the service&#8217;s authentication server who exchanges it for another security
token that is then presented to the service. All the exchanges in red are bog standard
OAuth WRAP calls. The only thing needed to be added to support finger is 4/4R in
blue. My guess is that even 4/4R will be an OAuth WRAP profile extension where
the wrap_scope will probably be a URI indicating the user and service that is being
sought. Or maybe we can add another field. In any case it&#8217;s a pretty obvious
variation.
   <h4 class="subsectionHead"><span class="titlemark">4.1   </span> <a id="x1-130004.1"></a>Where did the refresh token in message 1 come from?</h4>
<!--l. 255--></p><p class="noindent" >I&#8217;m assuming that Martok&#8217;s calendar client is using OAuth WRAP section 6.3 to get
a refresh token to allow it to talk to Martok&#8217;s identity provider. I intend to go more
into this scenario in a future article.
<!--l. 261--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.2   </span> <a id="x1-140004.2"></a>How can the access token from 1R be used both in message 2 and message
5?</h4>
<!--l. 263--></p><p class="noindent" >Both requests require the client to authenticate itself to the same service, Martok&#8217;s
identity provider, so the same access token can be used. The only problem is if
enough time passed between message 2 and 5 that the access token (which is
typically short lived) expired. In that case the client would need to repeat
request 1 to get a new access token. This is all standard OAuth WRAP
behavior.
<!--l. 272--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.3   </span> <a id="x1-150004.3"></a>Well then, why couldn&#8217;t the access token from 3R be used with request
6?</h4>
<!--l. 274--></p><p class="noindent" >Because access tokens are service specific. The access token returned in 3R was only
good with the finger service so it couldn&#8217;t be used with the calendar service.
Therefore the client had to execute request 5 to get an access token for the calendar
service.
<!--l. 281--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.4   </span> <a id="x1-160004.4"></a>Wait, remind me again, how did Martok&#8217;s calendar client know where Dax&#8217;s
finger service was?</h4>
<!--l. 283--></p><p class="noindent" >The scenario assumes that Martok, either directly or via an address book, gave
the client Dax&#8217;s e-mail address. Let&#8217;s assume that Dax&#8217;s e-mail address is
dax@example.com The calendar client pulled the domain name out of the e-mail
                                                                  

                                                                  
address, in this case example.com, and then created a request of the form
http://example.com/.well-known/finger-service. Note that I just made up
&#8217;finger-service&#8217;, the actual value will be whatever goes into the standard. The
interesting question is how did the request identify Dax?
<!--l. 292--></p><p class="indent" >   One way is in the URI itself. We could specify
https://example.com/.well-known/finger-service?localname=dax. We could even handle
cases where a finger service is handling an address from a domain other than its own
via https://example.com/.well-known/finger-service?email=dax@federation.com.
Alternatively Dax&#8217;s identifier could go into the request body, possibly into the
wrap_scope element.
<!--l. 300--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.5   </span> <a id="x1-170004.5"></a>Why do we bother with the previously mentioned STS/Kerberos two step
anyway?</h4>
<!--l. 302--></p><p class="noindent" >The answer is scalability. It turns out that requiring services to handle authentication
directly is expensive. Life works better if there is a centralized authentication service
who handles the expensive authentication actions and then hands out a short lived
token (typically good for a few hours) that can then be used with services
without further ado. This is why OAuth WRAP uses the refresh and access
tokens.
<!--l. 311--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.6   </span> <a id="x1-180004.6"></a>How did Martok get permission to access Dax&#8217;s finger service or free/busy
time?</h4>
<!--l. 313--></p><p class="noindent" >For the example we just assume that Dax said something like &#8221;anyone in my address
book can see my calendar location and my free/busy time&#8221; and Martok was in Dax&#8217;s
address book. Martok&#8217;s identity was validated to the finger and calendar
services by the security token issued by Martok&#8217;s identity provider. But in the
more general case I&#8217;m proposing that we extend OAuth WRAP to enable
individuals to ask each other for permissions. See <a href="http://www.goland.org/openpermission/" >here</a> and <a href="http://www.goland.org/oauthpermissioningexamples/" >here</a> for more
details.
<!--l. 326--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.7   </span> <a id="x1-190004.7"></a>How did Martok&#8217;s identity provider know how to issue security tokens
with formats and claims supported by Dax&#8217;s finger service and calendar
service?</h4>
<!--l. 328--></p><p class="noindent" >My guess is that if the finger service as proposed here takes off then there will be a
defined standard for a default security token format along with a default identity
claim that can be used in any situation where one entity needs to prove its &#8217;identity&#8217;
(in this case, an e-mail address) to another. See the previous question for why the
finger service and calendar service honored the identity assertion from Martok&#8217;s
identity provider.
                                                                  

                                                                  
<!--l. 338--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.8   </span> <a id="x1-200004.8"></a>Couldn&#8217;t Dax&#8217;s finger server tell Dax&#8217;s calendar server that Martok is
allowed to have access to free/busy time?</h4>
<!--l. 340--></p><p class="noindent" >This is a feature I&#8217;m interested in mostly because over time individuals trying to
manage their security in a coherent way are going to get a really serious headache.
How can anyone remember which permissions they gave to which services for which
people? What&#8217;s needed is a centralized place where users can manage their
permissions across many services. The finger server could either be that service or be
in communication with that service. In that case rather than Dax telling the
calendaring service directly &#8221;Give Martok access&#8221;, she could instead tell this to her
centralized permission service who would then be discovered by Martok using the
finger service. Martok would then ask that central permissioning service for a token
to give to Dax&#8217;s calendar service to prove he had a right to access her free/busy
time.
<!--l. 353--></p><p class="indent" >   But I think it&#8217;s premature to try and create this kind of infrastructure
right now. To be blunt, until it hurts nobody is going to spend time and
money fixing it. So while some enterprises are just now barely trying to get
started on issues like managing security policy across multiple internal services
(and believe me, that hurts way worse than a single user managing their
permissions) I suspect users effectively addressing this issue is some way into the
future.
<!--l. 361--></p><p class="indent" >   In fact my strong suspicion is that the way things will really work is that users are
going to synch at least the e-mails in their address books across services and then
specify permissions based on the address book&#8217;s structure or tags. &#8221;Anyone
marked as family can edit X&#8221; or &#8221;Anyone marked as business can see Y&#8221;,
etc.
<!--l. 367--></p><p class="indent" >   It&#8217;s tempting to argue that we shouldn&#8217;t design a system we know is problematic
at the start but synchronized permission management is an unsolved problem mostly
because we aren&#8217;t sure as to the most effective way to present permissions to users
(this is also known as a the policy problem).
<!--l. 374--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">4.9   </span> <a id="x1-210004.9"></a>Couldn&#8217;t Dax have multiple calendar services?</h4>
<!--l. 376--></p><p class="noindent" >Absolutely. My guess is that services like calendars will have standard finger schemas
that can say things like &#8221;I&#8217;m the work calendar&#8221; or &#8221;I&#8217;m the second personal
calendar&#8221; or whatever. It will be up to Martok and his calendar client to
decide how many of those services he should try to synch free/busy time for. <a id="Q1-1-23"></a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.goland.org/simplewebfinger/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>The outline of a profile for granting permissions using OAuth WRAP</title>
		<link>http://www.goland.org/oauthpermissioningexamples/</link>
		<comments>http://www.goland.org/oauthpermissioningexamples/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 22:20:01 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[SOA/Web/Etc.]]></category>

		<guid isPermaLink="false">http://www.goland.org/?p=745</guid>
		<description><![CDATA[In a previous article I talked about adding a profile to OAuth WRAP that would enable users to ask for or grant permissions to each other. In this article I show that an OAuth WRAP profile to handle granting permissions only needs two request/response pairs. I then show that an OAuth WRAP profile to handle [...]]]></description>
			<content:encoded><![CDATA[     <!--l. 32--><p class="indent" >    <span class="aer-9">In a </span><a href="http://www.goland.org/openpermission" ><span class="aer-9">previous</span></a> <span class="aer-9">article I talked about adding a profile to OAuth WRAP</span>
     <span class="aer-9">that would enable users to ask for or grant permissions to each other.</span>
     <span class="aer-9">In this article I show that an OAuth WRAP profile to handle granting</span>
     <span class="aer-9">permissions only needs two request/response pairs. I then show that an</span>
     <span class="aer-9">OAuth WRAP profile to handle asking for permissions only needs one</span>
     <span class="aer-9">additional exchange.</span>
<span id="more-745"></span>
       <h3 class="likesectionHead"><a id="x1-1000"></a><span class="aer-9">Contents</span></h3>
       <div class="tableofcontents">
       <span class="sectionToc" ><span class="aer-9">1 </span><a href="#x1-20001" id="QQ2-1-2"><span class="aer-9">Granting Permission - The free/busy time example</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">1.1 </span><a href="#x1-30001.1" id="QQ2-1-4"><span class="aer-9">How did Joe know to tell Yahoo that Mike keeps his calendar at Live?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">1.2 </span><a href="#x1-40001.2" id="QQ2-1-5"><span class="aer-9">What if Mike has multiple calendar services?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">1.3 </span><a href="#x1-50001.3" id="QQ2-1-6"><span class="aer-9">How did Live know the requests came from Yahoo?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">1.4 </span><a href="#x1-60001.4" id="QQ2-1-7"><span class="aer-9">How did Live know what permission Yahoo was asking for?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">1.5 </span><a href="#x1-70001.5" id="QQ2-1-8"><span class="aer-9">How did Live know that joe@google.com was the one who asked</span>
     <span class="aer-9">Yahoo to make the request?</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">1.6 </span><a href="#x1-80001.6" id="QQ2-1-9"><span class="aer-9">How does Joe remove permission for Mike to see his free/busy time?</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">2 </span><a href="#x1-90002" id="QQ2-1-10"><span class="aer-9">Asking for permission - extending the free/busy time example</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">2.1 </span><a href="#x1-100002.1" id="QQ2-1-12"><span class="aer-9">How does Live know that the notification in 7 is a response to the request in 4?</span></a></span>
       </div>

                                                                  

                                                                  
<!--l. 42--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">1   </span> <a id="x1-20001"></a>Granting Permission - The free/busy time example</h3>
<!--l. 44--></p><p class="noindent" >In this example the user joe@google.com, who uses the Yahoo Calendar service,
wants to give permission to mike@example.com, who uses the Live calendar service,
to see Joe&#8217;s free/busy time. Mike will then login to Live calendar service, accept Joe&#8217;s
permission grant and then schedule a meeting with Joe where Joe&#8217;s free/busy time
will be displayed to Mike.
<!--l. 52--></p><p class="indent" >   <hr class="figure"/><div class="figure" 
>
                                                                  

                                                                  
<a id="x1-20011"></a>
                                                                  

                                                                  
                                                                  

                                                                  
<!--l. 53--><p class="noindent" >
<object data="SimplePermissionGranting.svg" type="image/svg+xml" width="950pt" height="590"></object>
<!--tex4ht:graphics  
name="Oauthpermissioningexamples0x.png" src="2_Users_yarongoland_Documents_Unfinished_Website_Articles_SimplePermissionRequest.eps"  
-->
<br /> <div class="caption" 
><span class="id">Figure&#x00A0;1: </span><span class="content">Granting Permission - Free/Busy time example</span></div><!--tex4ht:label?: x1-20011 -->
                                                                  

                                                                  
<!--l. 59--></p><p class="indent" >   </p></div><hr class="endfigure"/>
<!--l. 62--></p><p class="indent" >   In looking at the sequence diagram it&#8217;s worth noting that the entire proposal
comes down to creating a profile for OAuth WRAP that introduces request/response
pairs 2/2R and 3/3R. That&#8217;s it.
<!--l. 66--></p><p class="indent" >   7/7R are already defined by OAuth WRAP, 8/8R are defined by other protocols
like CalDAV and everything else occurs outside of any standard context. So while a
lot is going on the amount we have to add to enable interoperability is quite small.
The sequence diagram does, however, bring up some interesting issues that I explore
below.
   <h4 class="subsectionHead"><span class="titlemark">1.1   </span> <a id="x1-30001.1"></a>How did Joe know to tell Yahoo that Mike keeps his calendar at
Live?</h4>
<!--l. 75--></p><p class="noindent" >One can imagine that Joe went into his Yahoo address book and clicked on a button
saying "Give Mike permission to see my free/busy time". Yahoo knows that Mike&#8217;s
e-mail address is mike@example.com but how does Yahoo figure out where Mike
keeps his calendar? I don&#8217;t think it will ever make sense to ask a customer where
their friend&#8217;s calendar is because the customer might either not know or have
the wrong answer. For privacy reasons Yahoo in many cases can&#8217;t tell the
customer if their choice is right or wrong. So my suspicion is that Yahoo will
need to find out for itself where the calendar is for the associated e-mail
address.
<!--l. 86--></p><p class="indent" >   In the long term there will exist discovery services that given an identifier like an
e-mail address can return information such as where the owner&#8217;s calendar(s) is(are). I
hope to discuss my ideas around that problem in another article. But in the short
term my guess is that services will just have to ask their partners. In some cases,
where there is very deep trust (or very long legal agreements and enough money to
sue if things go bad) services will just bulk upload lists of who they host calendars for
to their partners and update those lists on a regular basis. In other cases a
service will have to send a protocol request to their partners asking "Do
you host X&#8217;s calendar?" This request/response pair is shown in 2/2R in the
diagram.
<!--l. 99--></p><p class="indent" >   This means that a service like Yahoo who is probably partnered with a large
number of other services will either have to check its local database of bulk uploads
and/or make queries to partner services in order to figure out where a user&#8217;s calendar
is. This won&#8217;t scale but it&#8217;s probably o.k. in the short term until the discovery service
infrastructure is up and running.
<!--l. 107--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">1.2   </span> <a id="x1-40001.2"></a>What if Mike has multiple calendar services?</h4>
<!--l. 109--></p><p class="noindent" >We can easily imagine that Mike has a personal calendar that he keeps at Live and a
work calendar that is run from his business. One can also imagine that both Live and
Mike&#8217;s business are federated with Yahoo. So when Yahoo goes out looking for where
Mike&#8217;s calendar is they are likely to find not one, but two calendars. In fact it
                                                                  

                                                                  
could be even more complicated. Let&#8217;s say that before deciding that Live
was his primary personal calendar service Mike created accounts with a
few other calendar services. He has since abandoned those calendars but he
used the same e-mail address, mike@example.com, to create all the calendar
accounts. If Yahoo is federated/registered with those calendaring services then
Yahoo could find itself having numerous potential calendaring services who all
say they represent mike@example.com and at least two of them are even
right!
<!--l. 123--></p><p class="indent" >   One suspects that the only sane way to handle this for now is for Yahoo to just
find all the calendar services who have an entry for Mike and send the permission
request to all of them. Most likely Mike will probably accept Joe&#8217;s request for his
Live calendar and reject Joe&#8217;s request for his work calendar. But just as likely
Joe might accept both requests and that&#8217;s probably a good thing. In the
end Joe needs to know when Mike is busy, if Mike hasn&#8217;t federated his two
calendars together then the only way to have an accurate picture of Mike&#8217;s
activities is to get free/busy time from both calendars. Yahoo would then
pull the data from both and show Joe a unified free/busy time view for
Mike.
<!--l. 136--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">1.3   </span> <a id="x1-50001.3"></a>How did Live know the requests came from Yahoo?</h4>
<!--l. 138--></p><p class="noindent" >In the sequence diagram Yahoo sends two requests to Live, one to find out if Live has
Mike&#8217;s calendar (2/2R) and another to notify Live that Joe has granted
Mike permission to see Joe&#8217;s free/busy time (3/3R). In the short run my
guess is that services like Live will require services that want to talk to it to
register and as part of that registration the requesting service, in this case
Yahoo, will get what OAuth WRAP calls a client id and a client secret.
Yahoo will include those values in its requests and so authenticate itself to
Live.
<!--l. 147--></p><p class="indent" >   In the long run I&#8217;d actually like to see an ad-hoc system that lets two services
exchange requests without a previous relationship. In a future blog post I hope to
explain how this could be made to work.
<!--l. 152--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">1.4   </span> <a id="x1-60001.4"></a>How did Live know what permission Yahoo was asking for?</h4>
<!--l. 154--></p><p class="noindent" >My guess is that requests 2/2R and 3/3R will use the OAuth WRAP
request/response format which is just HTML Forms. So we would expect that
request 3 will include some indicator of what permission or permissions are
being asked for. This is nothing new in and of itself, OAuth handles this
all the time today. What&#8217;s unfortunate is that the way OAuth typically
handles this is that every service posts its own unique list of permissions it
handles and anyone wanting to work with that service has to work with that
service&#8217;s permissions. This makes economies of scale hard to come by. Also the
                                                                  

                                                                  
permissioning part of the game is the easy part, all things considered. The
hard work comes in request/response pair 8/8R where the free/busy time is
retrieved.
<!--l. 166--></p><p class="indent" >   My hope is that folks in communities like calendaring, document sharing, etc. will
get together and create packages of both claims for use with OAuth WRAP as well as
details on what protocols to use along with those permissions. But one step at a
time.
<!--l. 173--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">1.5   </span> <a id="x1-70001.5"></a>How did Live know that joe@google.com was the one who asked Yahoo to
make the request?</h4>
<!--l. 175--></p><p class="noindent" >The real question is probably more subtle - how did Yahoo know its user was the
legitimate owner of joe@google.com? It turns out that there are a non-trivial number
of ways that Yahoo could have validated Joe&#8217;s identify. But the two typical
approaches are:
     <dl class="description"><dt class="description">
<span class="aebx-10">E-mail</span><span class="aebx-10">&#x00A0;Validation</span> </dt><dd class="description">Joe  could  have  created  an  account  with  Yahoo  using
     the e-mail address &#8217;joe@google.com&#8217; and Yahoo e-mailed a confirmation
     message to that address that Joe then had to click on and then log in
     again. This provides reasonable proof that the user owns the e-mail address
     &#8217;joe@google.com&#8217;.
     </dd><dt class="description">
<span class="aebx-10">WS-Federation,</span><span class="aebx-10">&#x00A0;SAML-P</span><span class="aebx-10">&#x00A0;or</span><span class="aebx-10">&#x00A0;OpenID</span> </dt><dd class="description">Yahoo   could   have   a   trusted
     federation  with  Google  and  so  accept  Google&#8217;s  attestations  of  Joe&#8217;s
     identity.</dd></dl>
<!--l. 189--></p><p class="noindent" >My guess is that initially Live will require that Yahoo disclose the mechanism used to
authenticate the user&#8217;s identity. Live will then decide how to proceed based on
context and the authentication mechanism. Yahoo&#8217;s disclosure could be as simple as a
field in the permission notification request that says "auth_type = EmailValidation"
or what have you. Live would then trust that Yahoo was being honest about the
value it put in the auth_type claim.
<!--l. 197--></p><p class="indent" >   There are some edge case scenarios where a service that is giving permission
might not know the public identity of the person granting the permission. I have
some ideas on how to solve that problem but they are fairly complex so I&#8217;ll save them
for another day.
<!--l. 203--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">1.6   </span> <a id="x1-80001.6"></a>How does Joe remove permission for Mike to see his free/busy
time?</h4>
<!--l. 205--></p><p class="noindent" >In message 1R Yahoo let Joe know that it was able to deliver the notification request,
although Yahoo won&#8217;t tell Joe where the request was sent. But Joe won&#8217;t ever know
                                                                  

                                                                  
if Mike actually accepted the request since, to be blunt, it&#8217;s none of Joe&#8217;s business.
Joe can offer the permission but that&#8217;s it. But what is Joe&#8217;s business is if Joe
changes his mind and wants to withdraw permission he needs a way to do
that.
<!--l. 212--></p><p class="indent" >   Thankfully removing permissions can be handled completely outside of the
protocol. Joe needs to let Yahoo know that he no longer wants Mike to be
able to see his free/busy time and at that point Yahoo will remove Mike&#8217;s
permission from its permission store. It&#8217;s worth remembering that the way OAuth
WRAP works every time a particular user gives a particular permission to
another particular user a refresh token is issued. That token is unique to the
combination of Source User/Source Service/Destination User/Destination
Service/Permission. In our case that is joe@google.com/Yahoo Calendaring
Service/mike@example.com/Live Calendaring Service/See Free Busy time. So the
next time that Live comes with the refresh token (request 7) to get a new
access token (7R) the request will be denied since Joe had Yahoo remove the
permission.
<!--l. 226--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">2   </span> <a id="x1-90002"></a>Asking for permission - extending the free/busy time example</h3>
<!--l. 228--></p><p class="noindent" >In this version of the example Mike asks for permission to see Joe&#8217;s free busy time.
By way of reference, in the previous example Joe pre-emptively granted Mike
permission, Mike hadn&#8217;t asked. The scenario is that Mike creates a meeting in the
Live calendar service and invites Joe. Live sees that Mike doesn&#8217;t have Joe&#8217;s
free/busy time and prompts Mike if he would like to ask Joe to see his free/busy
time. Mike responds in the affirmative. Yahoo queries the services it knows to see if
anyone owns Joe&#8217;s calendar and gets a positive response from Yahoo. So Live asks
Yahoo to forward a free/busy time view request to Joe from Mike. Mike logs in, sees
the request and approves it. At that point the rest of the flow is essentially
identical to the previous example. Yahoo notifies Live that Joe has granted the
permission and Live uses that permission to show Joe&#8217;s free/busy time to
Mike.
<!--l. 243--></p><p class="indent" >   <hr class="figure"/><div class="figure" 
>
                                                                  

                                                                  
<a id="x1-90012"></a>
                                                                  

                                                                  
                                                                  

                                                                  
<!--l. 244--><p class="noindent" >
<object data="SimplePermissionRequest.svg" type="image/svg+xml" width="976.64874pt" height="734.745pt"></object>
<!--tex4ht:graphics  
name="Oauthpermissioningexamples1x.png" src="2_Users_yarongoland_Documents_Unfinished_Website_Articles_SimplePermissionRequest.eps"  
-->
<br /> <div class="caption" 
><span class="id">Figure&#x00A0;2: </span><span class="content">Asking for permission - extending the free/busy time example</span></div><!--tex4ht:label?: x1-90012 -->
                                                                  

                                                                  
<!--l. 250--></p><p class="indent" >   </p></div><hr class="endfigure"/>
<!--l. 253--></p><p class="indent" >   In comparing this example to the previous example only one new request/response
pair is added, 4/4R. All the other request/response pairs that deal with anything
that needs to be standardized are already defined in the previous example. And even
4/4R is a variant on 7/7R.
<!--l. 258--></p><p class="indent" >   A variant on this scenario would be to have Mike both request Joe&#8217;s free/busy
time while simultaneously granting Joe the right to see Mike&#8217;s free/busy time. But I
suspect these should be modeled as two separate interactions.
   <h4 class="subsectionHead"><span class="titlemark">2.1   </span> <a id="x1-100002.1"></a>How does Live know that the notification in 7 is a response to the request in
4?</h4>
<!--l. 267--></p><p class="noindent" >Strictly speaking correlation isn&#8217;t necessary since Live should be able to recognize
that it asked for specific permission from Yahoo for a specific user and if it later gets
that permission then matching the request with the response shouldn&#8217;t be a big deal.
One can imagine Live keeping a table where the index is on a set of columns that
specify what service the request went to, what user at the server it was
targeted at, what permission was asked for and what local user made the
request. Correlating 7 with 4 then becomes a simple task of looking up the
appropriate entry in the table. If there is an entry then this is a response to a
previous permission request and if there isn&#8217;t an entry then this is the previous
example.
<!--l. 279--></p><p class="indent" >   But if we really want we can just include a correlation ID from Live in request 4
that Yahoo is expected to include in 7 because 7 was generated in response to 4. If 7
was generated on its own (e.g. the previous example) then no correlation ID would be
present.
<a id="Q1-1-13"></a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.goland.org/oauthpermissioningexamples/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open permissions matter for an open web</title>
		<link>http://www.goland.org/openpermission/</link>
		<comments>http://www.goland.org/openpermission/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 05:11:15 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[SOA/Web/Etc.]]></category>

		<guid isPermaLink="false">http://www.goland.org/?p=741</guid>
		<description><![CDATA[The key to an open social web is permissions. There is data we don&#8217;t want to share and data we do want to share, permissions let us create the appropriate barriers. Closed networks like Facebook have reasonably rich permission infrastructures but what about open networks? How should Google and Microsoft enable document sharing across Google [...]]]></description>
			<content:encoded><![CDATA[<p class="indent" >    <span class="aer-9">The key to an open social web is permissions. There is data we don&#8217;t</span>
     <span class="aer-9">want to share and data we do want to share, permissions let us create the</span>
     <span class="aer-9">appropriate barriers. Closed networks like Facebook have reasonably rich</span>
     <span class="aer-9">permission infrastructures but what about open networks? How should</span>
     <span class="aer-9">Google and Microsoft enable document sharing across Google Docs and</span>
     <span class="aer-9">Sharepoint Online? Sure WebDAV can handle the actual mechanics of</span>
     <span class="aer-9">listing out documents, editing, etc. But how do the permissions get put</span>
     <span class="aer-9">into place in an open manner directly between users of the two services?</span>
     <span class="aer-9">This is a hole in the standards infrastructure and it&#8217;s time to fill it.</span>
<span id="more-741"></span>
       <h3 class="likesectionHead"><a id="x1-1000"></a><span class="aer-9">Contents</span></h3>
       <div class="tableofcontents">
       <span class="sectionToc" ><span class="aer-9">1 </span><a href="#x1-30001" id="QQ2-1-3"><span class="aer-9">Bring in the scenarios!</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">1.1 </span><a href="#x1-40001.1" id="QQ2-1-4"><span class="aer-9">Notification that permission has been granted</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">1.2 </span><a href="#x1-50001.2" id="QQ2-1-5"><span class="aer-9">Asking for permission</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">2 </span><a href="#x1-60002" id="QQ2-1-6"><span class="aer-9">Breaking down the scenarios</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">2.1 </span><a href="#x1-70002.1" id="QQ2-1-7"><span class="aer-9">Notification that permission has been granted</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">2.2 </span><a href="#x1-80002.2" id="QQ2-1-8"><span class="aer-9">Asking for permission</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">3 </span><a href="#x1-90003" id="QQ2-1-9"><span class="aer-9">Addressing the scenario components</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.1 </span><a href="#x1-100003.1" id="QQ2-1-10"><span class="aer-9">Identify the principal</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.2 </span><a href="#x1-110003.2" id="QQ2-1-11"><span class="aer-9">Discovery where to deliver the permission notification/request</span></a></span>
                                                                  

                                                                  
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.3 </span><a href="#x1-120003.3" id="QQ2-1-12"><span class="aer-9">Deliver the permission notification/request</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.4 </span><a href="#x1-130003.4" id="QQ2-1-13"><span class="aer-9">Utilize the permission</span></a></span>
     <br />     <span class="aer-9">&#x00A0;</span><span class="subsectionToc" ><span class="aer-9">3.5 </span><a href="#x1-140003.5" id="QQ2-1-14"><span class="aer-9">Describe the permission</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">4 </span><a href="#x1-150004" id="QQ2-1-15"><span class="aer-9">Conclusion</span></a></span>
       </div>

<!--l. 45--></p><p class="indent" >
   <h1 class="likepartHead"><a id="x1-2000"></a>Disclaimer</h1>
<!--l. 47--></p><p class="noindent" >This article represents my personal opinions and only my personal opinions. Nothing
in this article should be construed as representing my current employers opinions,
actions, plans, or what have you.
   <h3 class="sectionHead"><span class="titlemark">1   </span> <a id="x1-30001"></a>Bring in the scenarios!</h3>
<!--l. 55--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">1.1   </span> <a id="x1-40001.1"></a>Notification that permission has been granted</h4>
<!--l. 57--></p><p class="noindent" >Jane works at Big Corp international where she uses Exchange to maintain
her work calendar. Jane wants to give her spouse, Lucy, permission to see
her free/busy time so that Lucy can schedule events with Jane that won&#8217;t
interfere with Jane&#8217;s work schedule. Jane sets up a permission for Lucy in her
calendar granting Lucy permission to see Jane&#8217;s free/busy time. Lucy, who uses
Yahoo Calendaring for her personal calendar, is notified by Yahoo that Jane
has granted the permission and asked if she accepts the permission. Lucy
accepts the permission and Jane&#8217;s free/busy time is displayed in Lucy&#8217;s Yahoo
Calendar.
<!--l. 68--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">1.2   </span> <a id="x1-50001.2"></a>Asking for permission</h4>
<!--l. 70--></p><p class="noindent" >Morgan is a vendor hired by Istvan&#8217;s company to help with a project. Morgan uses
Google Docs to edit and manage documents while Istvan uses Sharepoint Online. To
get the project done Morgan needs access to certain documents in Istvan&#8217;s
Sharepoint. Morgan uses a permission request dialog in Google Docs to send a
request to Sharepoint Online asking Istvan for access to Istvan&#8217;s Sharepoint.
Sharepoint Online receives the request and shows it to Istvan who approves granting
Morgan read/write access to a particular sub-directory in Istvan&#8217;s Sharepoint.
Sharepoint Online then notifies Google Docs that Istvan has granted Morgan
read/write permissions to a directory in Istvan&#8217;s Sharepoint. Google Docs notifies
Morgan and displays the folder from Istvan&#8217;s Sharepoint as part of Morgan&#8217;s Google
                                                                  

                                                                  
Docs workspace.
<!--l. 84--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">2   </span> <a id="x1-60002"></a>Breaking down the scenarios</h3>
<!--l. 86--></p><p class="noindent" >Below I break the scenarios into what I think are the &#8217;key&#8217; actions. My suspicion is
that if we can define reasonable ways to achieve each of these actions then the rest of
the questions around how to implement the scenarios will more or less answer
themselves.
<!--l. 92--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">2.1   </span> <a id="x1-70002.1"></a>Notification that permission has been granted</h4>
<!--l. 93--></p><p class="noindent" >
     <dl class="description"><dt class="description">
<span class="aebx-10">Identify</span><span class="aebx-10">&#x00A0;the</span><span class="aebx-10">&#x00A0;principal</span> </dt><dd class="description">In  order  to  grant  a  permission  Jane  had  to  let
     Exchange Online know &#8217;who&#8217; Lucy is so that Exchange could transmit the
     permission to Lucy. What is the pointer used to identify Lucy to Exchange
     Online?
     </dd><dt class="description">
<span class="aebx-10">Describe</span><span class="aebx-10">&#x00A0;the</span><span class="aebx-10">&#x00A0;permission</span> </dt><dd class="description">What format did Exchange Online use to tell Lucy
     about the permission granted by Jane? What information is needed in the
     format?
     </dd><dt class="description">
<span class="aebx-10">Discover</span><span class="aebx-10">&#x00A0;where</span><span class="aebx-10">&#x00A0;to</span><span class="aebx-10">&#x00A0;deliver</span><span class="aebx-10">&#x00A0;the</span><span class="aebx-10">&#x00A0;permission</span><span class="aebx-10">&#x00A0;notification</span> </dt><dd class="description">How        did
     Exchange Online figure out where to deliver the permission notification
     to?
     </dd><dt class="description">
<span class="aebx-10">Deliver</span><span class="aebx-10">&#x00A0;the</span><span class="aebx-10">&#x00A0;permission</span><span class="aebx-10">&#x00A0;notification</span> </dt><dd class="description">What     are     the     details     of
     how Exchange Online delivered the permission notification, isn&#8217;t this just
     a spammers dream?
     </dd><dt class="description">
<span class="aebx-10">Utilize</span><span class="aebx-10">&#x00A0;the</span><span class="aebx-10">&#x00A0;permission</span> </dt><dd class="description">Assuming  that  Lucy  accepts  the  permission  how
     does she go about taking advantage of it?</dd></dl>
<!--l. 111--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">2.2   </span> <a id="x1-80002.2"></a>Asking for permission</h4>
<!--l. 112--></p><p class="noindent" >
                                                                  

                                                                  
     <dl class="description"><dt class="description">
<span class="aebx-10">Identify</span><span class="aebx-10">&#x00A0;the</span><span class="aebx-10">&#x00A0;principal</span> </dt><dd class="description">How did Aahan tell Facebook that he wanted to ask
     for permission from Aanjay at Flicker? What is the pointer that Aahan
     used to identify Aanjay to Facebook?
     </dd><dt class="description">
<span class="aebx-10">Describe</span><span class="aebx-10">&#x00A0;the</span><span class="aebx-10">&#x00A0;permission</span> </dt><dd class="description">How does Facebook tell Aanjay about her father&#8217;s
     permission  request?  What  is  the  format?  What  information  is  in  the
     format?
     </dd><dt class="description">
<span class="aebx-10">Discover</span><span class="aebx-10">&#x00A0;where</span><span class="aebx-10">&#x00A0;to</span><span class="aebx-10">&#x00A0;deliver</span><span class="aebx-10">&#x00A0;the</span><span class="aebx-10">&#x00A0;permission</span><span class="aebx-10">&#x00A0;request</span> </dt><dd class="description">How            does
     Facebook know where to deliver the permission request?
     </dd><dt class="description">
<span class="aebx-10">Deliver</span><span class="aebx-10">&#x00A0;the</span><span class="aebx-10">&#x00A0;permission</span><span class="aebx-10">&#x00A0;request</span> </dt><dd class="description">What  are  the  details  of  how  Facebook
     delivered the permission request, isn&#8217;t this just a spammers dream?</dd></dl>
<!--l. 125--></p><p class="noindent" >My assumption is that if the permission request is granted then notification of this fact
will be delivered in the manner specified in the previous section.
<!--l. 130--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">3   </span> <a id="x1-90003"></a>Addressing the scenario components</h3>
<!--l. 133--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.1   </span> <a id="x1-100003.1"></a>Identify the principal</h4>
<!--l. 135--></p><p class="noindent" >The obvious answer would seem to be e-mail addresses. Jane types in lucy@yahoo.com
(or more likely selects Lucy&#8217;s entry in Jane&#8217;s personal address book which then
resolves to lucy@yahoo.com). Unfortunately e-mail addresses are lousy identifiers for
a couple of reasons.
     <dl class="description"><dt class="description">
<span class="aebx-10">Late</span><span class="aebx-10">&#x00A0;bound</span><span class="aebx-10">&#x00A0;identifiers</span> </dt><dd class="description">Are identifiers that are resolved to a principal at
     time of use and are not guaranteed to always bind to the same principal. In
     other words, Jane&#8217;s spouse Lucy may have control over lucy@yahoo.com
     today, but who knows who might own lucy@yahoo.com tomorrow?
     </dd><dt class="description">
<span class="aebx-10">Non</span><span class="aebx-10">&#x00A0;transferable</span> </dt><dd class="description">If Lucy decides that she no longer wants to use Yahoo and
     would like to move to another identity provider or even be her own identity
     provider there is no well defined way to achieve this goal with an e-mail
     address. Once the address is abandoned, that&#8217;s it. There&#8217;s no forwarding
     mechanism.
                                                                  

                                                                  
     </dd><dt class="description">
<span class="aebx-10">Not</span><span class="aebx-10">&#x00A0;uniquely</span><span class="aebx-10">&#x00A0;bound</span><span class="aebx-10">&#x00A0;to</span><span class="aebx-10">&#x00A0;an</span><span class="aebx-10">&#x00A0;identity</span><span class="aebx-10">&#x00A0;provider</span> </dt><dd class="description">It&#8217;s  tempting  to  argue
     that when trying to interact with the identifier lucy@yahoo.com it makes
     the most sense to contact yahoo.com. But what to then make of folks
     like Live or Google who will let users create account with other identity
     provider&#8217;s e-mail names? For example, Lucy can create a Google account
     using her Yahoo address. So when typing in lucy@yahoo.com to give a
     calendaring permission does Jane mean Lucy&#8217;s calendar with Yahoo or
     Lucy&#8217;s calendar with Google?</dd></dl>
<!--l. 159--></p><p class="noindent" >These are all very serious problems but solving them will require introducing a new
identity infrastructure. There are ways to make this new infrastructure work over the
old one but the issues are complex and I think we should solve the easy problems
before the hard ones.
<!--l. 164--></p><p class="indent" >   So I&#8217;m going to assume that principals are identified by e-mail. Once we have
that more or less working we can move on to the more difficult identity
issues.
<!--l. 169--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.2   </span> <a id="x1-110003.2"></a>Discovery where to deliver the permission notification/request</h4>
<!--l. 171--></p><p class="noindent" >So who gets notified that a permission has been granted? I suspect a key requirement
is that we don&#8217;t mandate a single notification point for all services. In other words if I
want to notify someone about a calendaring permission I should be able to do that at
a different location than say an IM permission. That way services can be well
factored and spread out. But this also means that there needs to be some mechanism
to go from the principal identifier (an e-mail address) to the right address to notify
for a particular service.
<!--l. 180--></p><p class="indent" >   There is already a proposed solution for exactly this problem that we could, in
theory, build on top of - <a href="http://tools.ietf.org/html/draft-hammer-discovery" >Link-based Resource Descriptor Discovery (LRDD)</a>. But
besides supporting no less than three different discovery mechanisms and throwing in
<a href="http://docs.oasis-open.org/xri/xrd/v1.0/xrd-1.0.html" >XRD</a> I think LRDD has is backwards. It assumes that one publishes all the data to
be known about oneself. Besides wasting space this makes versioning and
extensibility a nightmare. What if one supports four different types of calendaring
protocol with various versions for each one? LRDD requires publishing the whole
lot.
<!--l. 190--></p><p class="indent" >   It&#8217;s tempting to argue that LRDD is easier to implement than a service since with
LRDD one can, in theory, just publish a static file. But given the type and
amount of data likely to be in a LRDD retrieved discovery file, the &#8217;static
file&#8217; argument is, in my mind, a fiction. The data in a LRDD file will be
dynamic and it will be maintained so it&#8217;s a service. Might as well treat it as
one.
<!--l. 197--></p><p class="indent" >   LRDD, besides describing what&#8217;s in the discovery file (e.g. the file containing the
pointers to various services) also describes how to find the discovery file for a
particular user when starting with an e-mail address. Specifically LRDD uses <a href="http://tools.ietf.org/html/draft-hammer-hostmeta" >Web
Host Metadata</a>. But this is just another static file (using the XRD format that is
                                                                  

                                                                  
also used in LRDD) that hangs off a well known address. Instead of using a
request/response service (&#8221;here is the e-mail I&#8217;m looking for&#8221;, &#8221;here is the address to
go to&#8221;) It uses a static file that includes a templating language which one downloads
and then locally feeds the e-mail address into the template which then spits out a
URL.
<!--l. 209--></p><p class="indent" >   So the LRDD process of going from an e-mail address to a service URL
involves two steps. First one retrieves the Web Host Metadata that contains
the pseudo-regular expression that one then downloads and &#8217;runs&#8217; locally
to translate the e-mail address to a LRDD discovery file location. Then
one retrieves the LRDD discovery file and from there finds out the service
address.
<!--l. 216--></p><p class="indent" >   Personally I think having a service at a well known location that one can send a
request of the form &#8221;I want to talk to the calendaring permission server for user X&#8221;
and get back a response would be oodles easier to implement and reason about and
involve one less hop.
<!--l. 221--></p><p class="indent" >   But in any case, at least there is some existing work to start from.
<!--l. 224--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.3   </span> <a id="x1-120003.3"></a>Deliver the permission notification/request</h4>
<!--l. 226--></p><p class="noindent" >In theory delivering the request or permission notification is easy enough, just
POST some bit of XML or JSON and call it a day. But this is going to be a
spammer/security nightmare. We need some authentication. But in this case we need
to authenticate the sender, which is the service sending the notification and not the
user who granted the permission. This simplifies things a bit and more accurately
represents who the responsible parties are. (Note: For you WS-* heads, this is
explicitly not an &#8217;act as&#8217; scenario)
<!--l. 235--></p><p class="indent" >   For services with long standing relationship HMAC&#8217;s can be used to
validate the POSTs by pre-arranging a shared secret. For ad-hoc scenarios I
suspect we&#8217;ll want to use digital signatures and leverage the previous discovery
mechanism to find the public key for a service. That way when a service receives a
message it can validate the signature by checking the source service&#8217;s public
key.
<!--l. 242--></p><p class="indent" >   Another check against spamming/security attacks is to make sure to only process
requests or permission notifications who are identified as coming from people the user
&#8217;trusts&#8217;, typically people in their address book. Yes, this leaves open the question
of how to handle requests that aren&#8217;t from folks in the address book but
most social networking systems already deal with this by asking users if
they wish to receive requests or permissions from people they don&#8217;t have
listed.
<!--l. 252--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.4   </span> <a id="x1-130003.4"></a>Utilize the permission</h4>
                                                                  

                                                                  
<!--l. 254--></p><p class="noindent" >In the case of a permission notice the service receiving the notice will need the right
information to use the permission on the user&#8217;s behalf. This is a classic OAuth use
case so my guess is that we should just use OAuth access tokens in the permission
notice and use the OAuth access pattern to exchange the access token for a request
token (or whatever they are called this week) which is then passed into the actual
service.
<!--l. 263--></p><p class="noindent" >
   <h4 class="subsectionHead"><span class="titlemark">3.5   </span> <a id="x1-140003.5"></a>Describe the permission</h4>
<!--l. 265--></p><p class="noindent" >This leaves the question (which I moved out of order because I actually think it&#8217;s the
least interesting question) of what the actual permission notification/request looks
like. My guess is that we should, again, rely on OAuth. It has a very simple format
that can be easily adapted for the purposes of describing anything and it
provides mechanisms for sending requests either over SSL or without. Again,
no need to get fancy. The whole thing then becomes just another OAuth
profile.
<!--l. 274--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">4   </span> <a id="x1-150004"></a>Conclusion</h3>
<!--l. 276--></p><p class="noindent" >I think we have all the pieces to create a really powerful ad-hoc sharing infrastructure
that can allow a user of any random kind of service to ask for or grant permissions to
any user of any other service. This is what a real, open, social web is all about. So
let&#8217;s get cracking!  </p>]]></content:encoded>
			<wfw:commentRss>http://www.goland.org/openpermission/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The CAP theorem and modern data centers &#8211; for now, choose consistency!</title>
		<link>http://www.goland.org/cap/</link>
		<comments>http://www.goland.org/cap/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 22:33:39 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[SOA/Web/Etc.]]></category>

		<guid isPermaLink="false">http://www.goland.org/?p=726</guid>
		<description><![CDATA[The dominance of the commodity machine model for data centers is so complete that one forgets that there was ever any other viable choice. But IBM, for one, is still selling lots of mainframes. Nevertheless the world I live in is built on top of data centers that contain a lot of commodity class machines. [...]]]></description>
			<content:encoded><![CDATA[<p>The dominance of the commodity machine model for data centers is
so complete that one forgets that there was ever any other viable
choice. But IBM, for one, is still selling lots of mainframes.
Nevertheless the world I live in is built on top of data centers that
contain a lot of commodity class machines. These machines have a
nasty habit of failing on a fairly regular basis. So when I think
about the CAP theorem I think about it in the context of a data
center filled with a bunch of not completely reliable boxes.</p>
<p>In that case partition tolerance (which, as I explain below, ends
up meaning tolerance of machine failure) is a requirement.  So in
designing frameworks for the data centers I work with the CAP theorem
makes me choose between exactly two choices -  do I want consistency
or availability?</p>
<p>My belief is that for the vast majority of developers, at least
for the immediate future, they need to choose consistency.</p>
<span id="more-726"></span>
<h2>Um... what's the CAP theorem?</h2>
<p>The CAP theorem is explained and proven in this <a HREF="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.20.1495&amp;rep=rep1&amp;type=pdf">theorem
paper</a> which is reasonably approachable. There are plenty of
articles on-line that summarize the CAP theorem so I'm not going to
write another one. I do however want to point out that the terms used
in the CAP theorem, consistency, availability and partition tolerance
don't mean what the plain meaning of the words imply.</p>
<p>Consistency is closest to its normal meaning but as the theorem
paper points out it might be easier to think of this as meaning
atomic and consistent in the AC part of ACID sense.</p>
<p>Availability, as I explore later, doesn't mean availability of the
entire system but rather availability of a particular piece of
information to be read or written to.</p>
<p>Partition tolerance is a tiny bit tricky. It's plain meaning, e.g.
dealing with what happens when machines can't talk to each other, is
part of the definition. But it also encompasses what happens if a
machine fails. After all, if machine A is trying to talk to machine B
and machine A isn't getting a response it's irrelevant if the
response didn't come because machine B failed or because there is a
network partition. The message didn't get where it was supposed to,
therefore the communication failure, from the perspective of the CAP
theorem, is modeled as a network partition.</p>
<p>The CAP theorem says of the previous three system qualities,
consistency, availability and partition tolerance, we only get to
choose two. (Wait, did I just summarize the CAP theorem? D'oh!)
Therefore when designing distributed systems I have three choices,
consistent/available, consistent/partition tolerant or
available/partition tolerant. I explore all three choice below.</p>
<h2>Consistent and Available - Not an option</h2>
<p>In an ideal world I would like all my service's data to be
consistent and available. But CAP says I only get that if I'm willing
to essentially fail if there is a network partition and as previously
discussed a network partition also includes machine failure.</p>
<p>And to be fair the consistent/available option is actually pretty
common. Anyone who is running a single box that hosts their database
is choosing this option. So long as the box is up their data is
consistent and available but if it (or its network tap) goes down
then that's that until the box gets fixed.</p>
<p>But as I mentioned above I come into this situation with a
dependency on data centers filled with commodity machines that tend
to fail on a pretty frequent basis. So wishing away machine failures
(or even network failures which, although rarer, do happen not
infrequently) is a non-starter. 
</p>
<p>So I have no choice, whatever design I use, it must be partition
tolerant (read: keep working in the face of machine failure). So
choosing consistency and availability over partition tolerance isn't
a choice available to me.</p>
<h2>Consistent and Partition Tolerant - Easy to program to</h2>
<p>I'm primarily in the development platform business. I build
platforms that other people use to build their software. So I spend a
lot of time worrying about abstractions that my customers can easily
understand and live with. The model most programmers are most
familiar with is one in which the world is 'consistent'. By which I
mean that when one wants to change system state one can do so and
either all the changes happen or they don't. Furthermore when someone
comes along to read values they will see the changes that have been
made. This is a world that is pretty easy to reason about.</p>
<p>But if I want to offer consistency and if, as I have previously
argued, I must have partition tolerance, then CAP says I have to give
up availability. Which might seem nuts. Who the heck wants a system
that isn't available? But remember, availability is not about the
global state of the system, it's about pieces of state that have to
be mutually consistent.</p>
<p>Imagine you are building a website for your car rental company.
You want to host the website in the cloud to save money and reduce
time to market. You come to me looking for storage infrastructure and
I say &quot;Hey, look, 99.99% of the time when your customer comes to
the website they will be able to access their data, put in an order
for a rental car, see what cars they have rented, etc. but 0.01% of
the time the customer request will fail and btw, typically that
failure will resolve itself within a minute or two.&quot;</p>
<p>To most businesses this is a fine trade off. Programming and
maintaining programs that expect consistency is an order of magnitude
less work than dealing with the lack of consistency (see the next
section). So a small number of failures that are quickly resolved is
probably an acceptable trade off.</p>
<h2>Available and Partition Tolerant - Takes a licking and keeps on
ticking</h2>
<p>Still, some companies, most famously Amazon's <a HREF="http://s3.amazonaws.com/AllThingsDistributed/sosp/amazon-dynamo-sosp2007.pdf">Dynamo</a>,
take availability very seriously. They don't ever want a customer
coming to their website and told 'sorry, we can't help you right now,
try again later.' They have done the math and figured out that even
rare failures, due to the enormous number of customers Amazon deals
with, were costing them real money. So Amazon was willing to deal
with the implementation headaches of reducing consistency in return
for getting higher availability.</p>
<p>Imagine we are using the previous system which chooses consistency
over availability. Let's say that Andres wants to rent a car. He
comes to the car rental site. The front end machine tries to access
Andres's rental records which are kept on machine Alpha (in reality
this would probably be a group of machines using a quorum protocol
with an elected master). But Alpha isn't available (i.e. the master
has died and the system is in processing of elevating another member
of the quorum to master or enough machines have died or been
partitioned so that quorum is lost). So the website has no choice but
to say &quot;please try again later&quot; until Alpha (or really the
quorum) can be brought back online.</p>
<p>Now let's look at a world with a lower level of consistency.
Andres comes to the website and the front end machine tries to get to
machine Alpha and fails. But rather than sending Andres away the
front end machine looks for another back end machine, let's call it
Beta, and asks it to handle Andres's rental records. Beta agrees. So
Andres goes through the rental process and rents a car. All this
information is recorded on machine Beta.</p>
<p>In the meantime it turns out that Beta failed before Alpha came
back up so the information that Beta had about Andres is currently
offline. Andres navigates back to the website to check on something
about his order. The front end machines goes looking for machines who
know about Andres and finds Alpha who is now back up. Much to his
surprise Andres is now shown that he has no rental order! After all,
Beta never told Alpha about the order and Beta is currently down. We
have a data inconsistency.</p>
<p>Andres, frustrated by this, puts in a second order and leaves.
Meanwhile Beta comes back up and finds Alpha. Now there is some
confusion. Both Beta and Alpha have orders from Andres for a car. Did
Andres mean to rent two cars? Is the newer order a replacement for
the older order? What should the system do?</p>
<p>All of these problems are solvable. It just takes very careful
thought about all the possible failure states and code that can
identify and resolve those failure states. The process of taking
inconsistent data and making it consistent over time as failed
systems come back on-line and share what they know is called
'<a HREF="http://queue.acm.org/detail.cfm?id=1466448">eventual
consistency</a>'.</p>
<p>Eventual consistency is an incredibly powerful mechanism for
making services more resilient but it isn't free. Modeling and
dealing with the potential problems are non-trivial. Much like the
inappropriate optimism around <a HREF="http://www.goland.org/optimisticconcurrency/">optimistic
concurrency</a> I suspect that in practice most implementers would do
well to stay away from eventual consistency frameworks. At least
until they can be reduced to well understood design patterns (a la
Amazon's shopping cart example). 
</p>]]></content:encoded>
			<wfw:commentRss>http://www.goland.org/cap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A mac fail? Please Help me with remote desktop</title>
		<link>http://www.goland.org/a-mac-fail-please-help-me-with-remote-desktop/</link>
		<comments>http://www.goland.org/a-mac-fail-please-help-me-with-remote-desktop/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 00:13:25 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Home PC]]></category>

		<guid isPermaLink="false">http://www.goland.org/a-mac-fail-please-help-me-with-remote-desktop/</guid>
		<description><![CDATA[I want to get a mac laptop for my wife but I want to be able to use it as a remote terminal for my iMac upstairs. There doesn&#8217;t appear to be a decent solution for this problem on the mac. VNC is a joke. It will just take my 24 inch iMac screen and [...]]]></description>
			<content:encoded><![CDATA[<p>I want to get a mac laptop for my wife but I want to be able to use it as a remote terminal for my iMac upstairs.</p>
<p>There doesn&#8217;t appear to be a decent solution for this problem on the mac. VNC is a joke. It will just take my 24 inch iMac screen and shrink it down to the laptop&#8217;s screen size. And yes I have played around with smart zoom but it&#8217;s really painful.</p>
<p>Isn&#8217;t there an equivalent for the mac to Microsoft&#8217;s outstanding Remote Desktop Connection application and RDP protocol?</p>
<p>For what it&#8217;s worth I signed up to be notified when AquaConnect releases their mac remote desktop product which is based on RDP but they aren&#8217;t even announcing dates. </p>
<p>Any ideas or am I just out of luck? </p>
]]></content:encoded>
			<wfw:commentRss>http://www.goland.org/a-mac-fail-please-help-me-with-remote-desktop/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Recovering from self inflicted data corruption &#8211; a summary</title>
		<link>http://www.goland.org/recovering-from-self-inflicted-data-corruption-a-summary/</link>
		<comments>http://www.goland.org/recovering-from-self-inflicted-data-corruption-a-summary/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 06:03:23 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[SOA/Web/Etc.]]></category>

		<guid isPermaLink="false">http://www.goland.org/?p=687</guid>
		<description><![CDATA[Of late I have been torturing myself about the question of - even if I build on top of a highly reliable storage service like Windows Azure Table Service do I still need to worry about backups, versioning, journals and such? The answer would seem to be, yes, I do. Mostly because even if the [...]]]></description>
			<content:encoded><![CDATA[ Of late I have been torturing myself about the question of - even if I build on top
of a highly reliable storage service like Windows Azure Table Service do I still
need to worry about backups, versioning, journals and such? The answer
would seem to be, <a href="http://www.goland.org/do-i-need-to-backupjournal-my-windows-azure-table-store/" >yes, I do</a>. Mostly because even if the table store works
perfectly, I&#8217;m still going to have bugs I introduced that are going to hork my
data.
<!--l. 38--><p class="indent" >   In fact what I specifically need to do is:
     <ol class="enumerate1" >
     <li class="enumerate" id="x1-3x1">Lobby the Windows Azure Table Storage team to add <a href="http://www.goland.org/techniques-to-ease-recovering-from-self-inflicted-data-corruption/#x1-80002" >undelete for tables</a>
     so if I accidentally blow away one of my tables I have some hope (oh and
     ACL&#8217;s would be nice too)
     </li>
     <li class="enumerate" id="x1-5x2">Be <a href="http://www.goland.org/techniques-to-ease-recovering-from-self-inflicted-data-corruption/#x1-90003" >very careful</a> about how I update my schemas
     </li>
     <li class="enumerate" id="x1-7x3">Implement a <a href="http://www.goland.org/buildingacommandjournal/" >command journal</a> (and be clear about their <a href="http://www.goland.org/thelimitsofcommandjournals/" >limitations</a>)
     </li>
     <li class="enumerate" id="x1-9x4">If time permits <a href="http://www.goland.org/tombstoneazuretablestore/" >implement tombstoning</a>
     </li>
     <li class="enumerate" id="x1-11x5">If I&#8217;m feeling really wacko implement my own <a href="http://www.goland.org/aversionedwindowsazuretablestore/#x1-50004" >versioning system</a> on top of
     the table store (or just <a href="http://www.goland.org/aversionedwindowsazuretablestore/#x1-30002" >backups</a> if I&#8217;m feeling only slightly wacko)
     </li>
     <li class="enumerate" id="x1-13x6">Put into place a <a href="http://www.goland.org/techniques-to-ease-recovering-from-self-inflicted-data-corruption/" >realistic plan</a> to take advantage of all these features while
     keeping in mind the <a href="http://www.goland.org/thelimitsofrecovery/" >limitations</a> of these techniques.</li></ol>
<!--l. 56--></p><p class="noindent" >The links in the previous text are to the other articles in this series that I wrote for my
blog. Those articles are:
                                                                  

                                                                  
     <ul class="itemize1">
     <li class="itemize"><a href="http://www.goland.org/do-i-need-to-backupjournal-my-windows-azure-table-store/" >Do I need to backup/journal my Windows Azure Table Store?</a>
     </li>
     <li class="itemize"><a href="http://www.goland.org/thelimitsofcommandjournals/" >The Limits of Command Journals</a>
     </li>
     <li class="itemize"><a href="http://www.goland.org/techniques-to-ease-recovering-from-self-inflicted-data-corruption/" >Techniques to Ease Recovering from Self Inflicted Data Corruption</a>
     </li>
     <li class="itemize"><a href="http://www.goland.org/buildingacommandjournal/" >Thoughts on implementing a command journal</a>
     </li>
     <li class="itemize"><a href="http://www.goland.org/tombstoneazuretablestore/" >Tombstoning on top of Windows Azure Table Store</a>
     </li>
     <li class="itemize"><a href="http://www.goland.org/thelimitsofrecovery/" >The limits of recovering from application logic failures</a>
     </li>
     <li class="itemize"><a href="http://www.goland.org/aversionedwindowsazuretablestore/" >Implementing Versioning in Windows Azure Table Store</a></li></ul>
    </p>]]></content:encoded>
			<wfw:commentRss>http://www.goland.org/recovering-from-self-inflicted-data-corruption-a-summary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implementing Versioning in Windows Azure Table Store</title>
		<link>http://www.goland.org/aversionedwindowsazuretablestore/</link>
		<comments>http://www.goland.org/aversionedwindowsazuretablestore/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 05:43:57 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[SOA/Web/Etc.]]></category>

		<guid isPermaLink="false">http://www.goland.org/?p=683</guid>
		<description><![CDATA[In a previous article I argued that I needed some kind of journaling/backup for my Windows Azure Tables in order to handle my own screw ups. In this article I re-examine the value of versioning for recovering from self inflicted data corruption. Discuss backups as a possible substitute for versioning. Look at what versioning might [...]]]></description>
			<content:encoded><![CDATA[     <!--l. 31--><p class="indent" >    <span class="aer-9">In   a   </span><a href="http://do-i-need-to-backupjournal-my-windows-azure-table-store/" ><span class="aer-9">previous   article</span></a>   <span class="aer-9">I   argued   that   I   needed   some   kind   of</span>
     <span class="aer-9">journaling/backup for my Windows Azure Tables in order to handle my</span>
     <span class="aer-9">own screw ups. In this article I re-examine the value of versioning for</span>
     <span class="aer-9">recovering from self inflicted data corruption. Discuss backups as a possible</span>
     <span class="aer-9">substitute for versioning. Look at what versioning might look like if added</span>
     <span class="aer-9">as  a  native  feature  of  Windows  Azure  Table  Store  and  finish  up  by</span>
     <span class="aer-9">proposing a design that would let me implement versioning on top of</span>
     <span class="aer-9">Windows Azure Table Store.</span>
</p><p>This article is part of a series. Click <a href="http://www.goland.org/recovering-from-self-inflicted-data-corruption-a-summary/">here</a> to see summary and complete list of articles in the series.</p>
<span id="more-683"></span>
       <h3 class="likesectionHead"><a id="x1-1000"></a><span class="aer-9">Contents</span></h3>
       <div class="tableofcontents">
       <span class="sectionToc" ><span class="aer-9">1 </span><a href="#x1-20001" id="QQ2-1-2"><span class="aer-9">The value of versioning</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">2 </span><a href="#x1-30002" id="QQ2-1-3"><span class="aer-9">What about backups?</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">3 </span><a href="#x1-40003" id="QQ2-1-4"><span class="aer-9">Imagining a versioned Windows Azure Table Store</span></a></span>
     <br />     <span class="sectionToc" ><span class="aer-9">4 </span><a href="#x1-50004" id="QQ2-1-5"><span class="aer-9">In place versioning on top of the table store</span></a></span>
       </div>

                                                                  

                                                                  
<!--l. 43--><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">1   </span> <a id="x1-20001"></a>The value of versioning</h3>
<!--l. 45--></p><p class="noindent" >The value of versioning in recovering from application errors has already been
covered <a href="http://www.goland.org/techniques-to-ease-recovering-from-self-inflicted-data-corruption/" >here </a>and <a href="http://www.goland.org/thelimitsofrecovery/" >here</a>. But to summarize - when it hits the fan versioning
can help one figure out if the original damage has been compounded by
subsequent changes. Furthermore version, by providing the outcome of a
command let&#8217;s one examine what happened in the past with less baggage than
needed to understand the past then the &#8217;replay&#8217; issues that plague <a href="http://www.goland.org/thelimitsofcommandjournals/" >command
journals</a>.
<!--l. 54--></p><p class="indent" >   Versioning is also useful as a last ditch &#8217;go back in time&#8217; mechanism where
if the damage is just too great to repair at least the system can provide
the option of turning back the clock to some better state. Although one
shouldn&#8217;t overstate the utility of this feature. In non-trivial cases there will
be a variety of side effects of &#8217;turning back the clock&#8217; that will be hard to
control and the clock can&#8217;t go too far back or issues with schema changes,
functionality changes, etc. come into play. Many of the same issues with replaying
command journals apply to using versioning as an emergency escape hatch to the
past.
<!--l. 64--></p><p class="indent" >   So while versioning is useful, I suspect that command journals and tombstones in
the average case probably provide the most bang for the buck. My real hope is that
systems like Windows Azure Table Store will offer versioning as a feature
so the cost and complexity of taking advantage of versioning will go way
down.
<!--l. 71--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">2   </span> <a id="x1-30002"></a>What about backups?</h3>
<!--l. 73--></p><p class="noindent" >As discussed below implementing versioning on top of the Windows Azure
Table Store, while not brain surgery, isn&#8217;t trivial either. A much simpler
technique would be to regularly backup tables. This can be done in the
background without having to interfere with normal operations. So it&#8217;s less
risky.
<!--l. 79--></p><p class="indent" >   Backups work using snapshots. At regular intervals the table is read in (typically
with a filter that ignores values that haven&#8217;t changed since the last snapshot) and a
snapshot created. Unfortunately snapshots miss things. If a value is changed
multiple times between snapshots then the intermediate values will not be
recorded.
<!--l. 85--></p><p class="indent" >   This leads to situations where if a buggy command is given between
snapshots and then the buggy value is overwritten just before the snapshot I
have no way of knowing what the original value was unless I can replay the
command (which is tricky and assumes that the value produced by the bug
is predictable). This makes it more or less impossible to handle the <a href="http://www.goland.org/thelimitsofrecovery/" >put
syndrome</a> since I can&#8217;t see if the same value was written twice or a new value
written.
<!--l. 94--></p><p class="indent" >   For similar reasons backups are not useful when dealing with the <a href="http://www.goland.org/thelimitsofrecovery/" >etag syndrome</a>
                                                                  

                                                                  
since it&#8217;s at best just luck if the snapshot happens to have captured the correct
system state at the time the command was executed.
<!--l. 98--></p><p class="indent" >   Also backups don&#8217;t deal at all well with deletes. Unless one copies the
entire table during every snapshot (a rather expensive proposition) then any
deleted records will be missed. So if one is going to implement delta based
snapshots (e.g. just copying things changed since last snapshot) then one
also needs to implement <a href="http://www.goland.org/tombstoneazuretablestore/" >tombstones</a> and backup the tombstone table as
well.
<!--l. 105--></p><p class="indent" >   If a transaction is in progress during a snapshot then only the parts of the
transaction that occurred before the snapshot will be captured, those coming after
will be missed until the next snapshot. So restoring from the most recent snapshot
means restoring the system to an inconsistent state. While inconsistency
happens anyway in loosely coupled systems its one thing for a user to issue
a command that fails in a bad way, something the user is generally told
about. It&#8217;s another thing for the system at some point to just &#8217;shift state&#8217; to
some previous, inconsistent, point and users are then told to pick up the
mess.
<!--l. 115--></p><p class="indent" >   Still, for all of that, at least backups offer some hope of turning back the
clock in the case of hopeless data corruption so perhaps they do have some
value.
<!--l. 120--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">3   </span> <a id="x1-40003"></a>Imagining a versioned Windows Azure Table Store</h3>
<!--l. 122--></p><p class="noindent" >Versioning tends to come in two flavors, linear and non-linear. My belief is that
Windows Azure Table Store only needs linear versioning. My reasoning is that if one
looks at the table store using the lens of the <a href="http://www.julianbrowne.com/article/viewer/brewers-cap-theorem" >CAP Theorem</a> then one notices that
Windows Azure Table Store focuses on availability and consistency. If one is willing
to give up partition tolerance (which Azure Table Store has) then most of the use
cases for non-linear versioning go away. It is possible in a consistent system to enforce
an order, even without locking, thanks to optimistic concurrency which the table
store supports.
<!--l. 133--></p><p class="indent" >   So if the table store supported linear versioning then the experience would be that
every write would cause a new version of a particular row to come into existence, I&#8217;ll
call that the tip version.
<!--l. 137--></p><p class="indent" >   All existing store commands would work exactly as they do now but would only
apply to the tip version and in the case of POST and PUT would create new tip
versions. The delete command would create a tombstone entry stating that the row
was deleted. The tombstone entry would be invisible to all the existing Windows
Azure Table commands.
<!--l. 143--></p><p class="indent" >   I don&#8217;t think that check-in/check-out semantics are appropriate to a highly
distributed system like the table store so the commands available to a versioning
aware client would actually be quite limited. I would add a way to specify a version
in the URL of a row (say with a query parameter) as well as a query to
include versions in the output of a table query. Finally I would support
                                                                  

                                                                  
the ability to destroy (as in delete without trace) a row. I don&#8217;t know that
much more than that is really needed in terms of interacting with older
versions.
<!--l. 153--></p><p class="noindent" >
   <h3 class="sectionHead"><span class="titlemark">4   </span> <a id="x1-50004"></a>In place versioning on top of the table store</h3>
<!--l. 155--></p><p class="noindent" >[Disclaimer: The following is more of a mental exercise. I haven&#8217;t had time to actually
mock this up and make sure all the details are right.]
<!--l. 159--></p><p class="indent" >   Right now Windows Azure Table Store doesn&#8217;t offering versioning so I&#8217;ve given
some thought to how I might implement versioning myself on top of the table store.
The services I work on that use the table store tend to be high read and low write. So
I want an approach to adding versioning to the table store that places the cost of
versioning more on writes than reads. I also want an approach that is more or
less guaranteed to produce consistent output. That is, I don&#8217;t want to end
up in a situation where the state of my production tables and my version
history are out of whack. The whole point of introducing versioning is that
it&#8217;s correct and complete so I can reason about certain things that would
otherwise be hard to do. If I can&#8217;t get consistency in my version store I might as
well use backups which at least are simpler to implement. Thankfully the
table store provides the features to meet all of my requirements including
consistency.
<!--l. 174--></p><p class="indent" >   The approach I would use is in place versioning. That is most current
version of a row (referred to as the tip) and its previous versions all live in the
same partition in the same table. This is the opposite of the approach I used
with tombstones because in the case of tombstones consistency wasn&#8217;t a
problem.
<!--l. 180--></p><p class="indent" >   In the in place versioning approach the tip version of any row will have whatever
partition key/row key it is supposed to have plus the prefix &#8221;tip&#8221; on the row key. This
means that anytime I want to interact with the tip version of a row I just generate
the expected partition key/row key and add in &#8221;tip&#8221; as a prefix on the row key. This
makes reads fast.
<!--l. 187--></p><p class="indent" >   Every column I&#8217;m versioning will contain a version ID which is a monotonically
increasing integer. The first time I create the &#8221;tip&#8221; version of a row (e.g. when the row
is first created) I will give it the version number 0. When updating a row I
will copy the old value and give it the prefix &#8221;old&#8221;. Then I&#8217;ll update the tip
version and increment its version number. The key to consistency with an in
place versioning approach is that it&#8217;s possible to both create the old version
and update the tip atomically. The table store&#8217;s <a href="http://msdn.microsoft.com/en-us/library/dd894038.aspx" >entity group transaction</a>
mechanism is guaranteed to be atomic and so can be used to solve exactly this
problem.
<!--l. 198--></p><p class="indent" >   To version enable a table store table I need either to build a proxy or a library.
My guess is that I would use a library to save the processing and network time of a
proxy but what is really nice about a proxy is that I can use the proxy as a lock
down mechanism. I can make sure nobody but the proxy has the key to the table so
                                                                  

                                                                  
if someone doesn&#8217;t go through the proxy then they don&#8217;t get access to the
data. That alone will prevent tons of bugs. By having a single proxy I can
also more easily control issues like versioning of the proxy code which deals
with a whole other set of bugs. But proxies do demand both a processing
and latency cost so I have to consider that in deciding between proxies and
libraries.
<!--l. 210--></p><p class="indent" >   The following goes through the standard methods in their non-version aware form
and explains how their behavior would change if one was using a version aware
library/proxy to interact with the table store using an in place versioning
approach.
     <dl class="description"><dt class="description">
<span class="aebx-10">GET</span> </dt><dd class="description">If the query contains a filter that specifies a rowkey then prefix the rowkey
     value(s) with &#8221;tip&#8221;. In all cases add the filter argument (if it doesn&#8217;t already
     exist) of &#8221;rowkey gt &#8217;old&#8221;&#8217;. This will filter out everything but tip versions
     of rows since &#8217;tip&#8217; comes after &#8217;old&#8217;.
     </dd><dt class="description">
<span class="aebx-10">DELETE</span> </dt><dd class="description">A GET is needed to retrieve the current &#8217;tip&#8217; version. If none exists
     then the request should fail since there is nothing to delete. If the tip
     version does exist then create an entity group transaction that includes
     creating a new row to act as the tombstone with a column &#8217;tombstone&#8217; set
     to true as well as a delete command for the current tip that includes the
     etag from the GET in an if-match header.
     </dd><dt class="description">
<span class="aebx-10">PUT</span> </dt><dd class="description">First retrieve the existing versions &#8217;tip&#8217; (using an etag if one was provided
     in an if-match or equivalent header). If there isn&#8217;t one then the resource
     doesn&#8217;t exist or has been deleted and so the request should fail. If the &#8217;tip&#8217;
     version exists then an entity group transaction is needed to update the tip
     version as previously described but use if-match with the etag retrieved
     from the original GET.
     </dd><dt class="description">
<span class="aebx-10">MERGE</span> </dt><dd class="description">The logic is the same as PUT for all intents and purposes. It&#8217;s just
     that values not specified in the MERGE request have to be retrieved from
     the soon to be replaced &#8217;tip&#8217; version to create the &#8217;old&#8217; prefixed copy.
     </dd><dt class="description">
<span class="aebx-10">POST</span> </dt><dd class="description">Check to see if a tip version exists. If so, then fail. If not then check to
     see if there is a tombstone. If so then issue the POST request with the
     version number set to an increment of the number in the tombstone. If
     there is no tombstone then the version number is 0 and row key will have
     &#8217;tip&#8217; added as a prefix.
     </dd><dt class="description">
<span class="aebx-10">Entity</span><span class="aebx-10">&#x00A0;group</span><span class="aebx-10">&#x00A0;transaction</span> </dt><dd class="description">In essence just glue together the instructions for
     the individual methods mentioned above and apply to the contents of the
                                                                  

                                                                  
     entity group transaction. Entity group transactions even support if-match
     headers.</dd></dl>
<a id="Q1-1-6"></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.goland.org/aversionedwindowsazuretablestore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
