Saturday, June 20, 2009

Help is coming for the Sreg/AX interop problem for OpenID

Just to get your mouth watering for DotNetOpenAuth v3.2...

V3.2 has a new "behaviors" plugin capability that lets RPs and OPs get additional functionality with very little effort.  For example, OPs can add PPID identifier support very easily with just a few lines of code. 

But of most interest I suspect is the sreg/AX interop behavior, which if activated in your web.config file (1 line), will cause an RP or an OP to see just sreg, yet on the wire do sreg and/or any of the 3 known AX attribute formats in order to maximize interoperability while keeping things extremely simple on the RP or the OP side.  So for example, you can prepare an sreg attribute request and send it to the OP, and if the OP only supports AX (and discovery can tell) then the sreg extension is automatically converted to AX in the right format and sent to the OP, then when the response comes back, the AX response is implicitly translated back to sreg so your web site can just deal with sreg.

If the OP doesn't advertise which attribute extensions and formats it supports, this optional DNOA behavior "spreads" the sreg extension to cover all possibilities to maximize the chance of getting the answer back that you want.  (Woot!)  No more hand writing all that interop code that makes the OpenID attribute extension story so embarrassing.  :)

The behavior does a similar trick for OPs, where all request formats look like sreg, and then when the response is sent out, it is converted back to whatever format the request came in.

You might be asking "Why are we making everything look like sreg?  Why not AX since it's newer/better?"  Fair question.  Sreg covers all the use cases for most OpenID sites at the moment, and since it's a subset of AX in almost every respect, an RP converting from sreg to AX implicitly does not lose any data.  And since it's a simpler extension, the object model to read/write it is simpler, making the RPs and OPs job simpler as well.  It seemed like the right thing for the times.  When AX finally gets its attribute type URI story together we can deprecate this behavior and we can all just use a single AX attribute format.

2 comments:

  1. Does this mean I can finally get a Nickname from google users?

    ReplyDelete
  2. No. As cool as the new feature is ;), it doesn't work miracles. Until Google supports nickname, you won't get that. But as soon as they do, you should get it if you're asking for it in the meantime.

    ReplyDelete