JabberID and OpenID combination : XEP-0154 User-Profile export

From XMPP WIKI
Revision as of 19:08, 24 July 2010 by Neustradamus (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

1. The user logs on for the first time to OpenID server with his JID. The OpenID server asks to the user if he wants to import his profile from his personal pubsub node. The user accepts and the OpenID server requests the profile:

<iq type='set'from='openid.shakespeare.lit'
    to='hamlet@denmark.lit'  id='sub1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <subscribe
        node='http://jabber.org/protocol/profile'
        jid='openid.shakespeare.lit'/>
  </pubsub>
</iq>

2. The XMPP server of the user replies to the OpenID server that its subscription is pending:

<iq type='result'
    from='hamlet@denmark.lit'
    to='openid.shakespeare.lit"
    id='sub1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <subscription
        node='http://jabber.org/protocol/profile'
        jid='openid.shakespeare.lit'
        subscription='subscription='pending''/>
  </pubsub>
</iq>

3. The user receives a pubsub subscription approval form from his XMPP server :

<message to='hamlet@denmark.lit/elsinore' from='denmark.lit' id='approve1'>
  <x xmlns='jabber:x:data' type='form'>
    <title>PubSub OpenID subscriber request</title>
    <instructions>
      To approve this entity's subscription request,
      click the OK button. To deny the request, click the
      cancel button.
    </instructions>
    <field var='FORM_TYPE' type='hidden'>
      <value>http://jabber.org/protocol/pubsub#subscribe_authorization</value>
    </field>
    <field var='pubsub#subid' type='hidden'><value>123-abc</value></field>
    <field var='pubsub#node' type='text-single' label='Node ID'>
      <value>http://jabber.org/protocol/profile</value>
    </field>
    <field var='pusub#subscriber_jid' type='jid-single' label='Subscriber Address'>
      <value>openid.shakespeare.lit</value>
    </field>
    <field var='pubsub#allow' type='boolean'
           label='Allow this JID to subscribe to this pubsub node?'>
      <value>true</value>
    </field>
  </x>
</message>

4. The user sends the subscription approval form to allow the OpenID server to subscribe to the node and retrieve the profile :

<message from='hamlet@denmark.lit/elsinore' to='denmark.lit' id='approve1'>
  <x xmlns='jabber:x:data' type='submit'>
    <field var='FORM_TYPE' type='hidden'>
      <value>http://jabber.org/protocol/pubsub#subscribe_authorization</value>
    </field>
    <field var='pubsub#subid'>
      <value>123-abc</value>
    </field>
    <field var='pubsub#node'>
      <value>http://jabber.org/protocol/profile</value>
    </field>
    <field var='pubsub#subscriber_jid'>
      <value>openid.shakespeare.lit</value>
    </field>
    <field var='pubsub#allow'>
       <value>true</value>
    </field>
  </x>
</message>

5. The XMPP server of the user sends the subscription approval notification to the OpenID server :

<message
    from='denmark.lit'
    to='open.shakespeare.lit'
    id='approvalnotify1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <subscription node='http://jabber.org/protocol/profile' jid='open.shakespeare.lit' subscription='subscribed'/>
  </pubsub>
</message>

6. The OpenID server discovers the profile :

<iq type='get'
    from='open.shakespeare.lit'
    to='hamlet@denmark.lit'
    id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>

<iq type='result'
    from='hamlet@denmark.lit'
    to='openid.shakespeare.lit'
    id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <identity category='account' type='registered'/>
    ...
    <feature var='http://jabber.org/protocol/profile'/>
    ...
  </query>
</iq>

7. The OpenID server retrieves the profile :

<iq type='get'
    from='openid.shakespeare.lit'
    to='hamlet@denmark.lit'
    id='iq1'>
  <profile xmlns='http://jabber.org/protocol/profile'/>
</iq>

<iq type='result'
    from='hamlet@denmark.lit'
    to='openid.shakespeare.lit'
    id='iq1'>
  <profile xmlns='http://jabber.org/protocol/profile'>
    <x xmlns='jabber:x:data' type='result'>
      <field var='FORM_TYPE' type='hidden'>
        <value>http://jabber.org/protocol/profile</value>
      </field>
      <field var='nickname'>
        <value>Hamlet</value>
      </field>
      <field var='country'>
        <value>DK</value>
      </field>
      <field var='locality'>
        <value>Elsinore</value>
      </field>
      <field var='email'>
        <value>hamlet@denmark.lit</value>
      </field>
    </x>
  </profile>
</iq>

8. The user modifies later his profile by adding a new field :

<iq type='set' id='pub1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='http://jabber.org/protocol/profile'>
      <profile xmlns='http://jabber.org/protocol/profile'>
        <x xmlns='jabber:x:data' type='result'>
          <field var='weblog'>
            <value>http://www.denmark.lit/blogs/princely_musings</value>
          </field>
        </x>
      </profile>
    </publish>
  </pubsub>
</iq>

9. The OpenID server receives the profile update :

<message to='openid.shakespeare.lit' from='hamlet@denmark.lit' type='headline' id='foo'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/profile'>
      <item>
        <profile xmlns='http://jabber.org/protocol/profile'>
          <x xmlns='jabber:x:data' type='result'>
            <field var='weblog'>
              <value>http://www.denmark.lit/blogs/princely_musings</value>
            </field>
          </x>
        </profile>
      </item>
    </items>
  </event>
</message>

Reference

Implementations & Services