No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0355.xml 36KB

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Namespace Delegation</title>
  10. <abstract>This specification provides a way for XMPP server to delegate treatments for a namespace to an other entity</abstract>
  12. <number>0355</number>
  13. <status>Deferred</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. <spec>XEP-0004</spec>
  20. <spec>XEP-0297</spec>
  21. </dependencies>
  22. <supersedes/>
  23. <supersededby/>
  24. <shortname>NOT_YET_ASSIGNED</shortname>
  25. <author>
  26. <firstname>Jérôme</firstname>
  27. <surname>Poisson</surname>
  28. <email></email>
  29. <jid></jid>
  30. </author>
  31. <revision>
  32. <version>0.4</version>
  33. <date>2017-09-11</date>
  34. <initials>XEP Editor (jwi)</initials>
  35. <remark>Defer due to lack of activity.</remark>
  36. </revision>
  37. <revision>
  38. <version>0.3</version>
  39. <date>2016-08-01</date>
  40. <initials>jp</initials>
  41. <remark>
  42. <ul>
  43. <li>added "Delegating server" in glossary</li>
  44. <li>fixed <link url='#stanza_forward'>server forwarding</link> conditions</li>
  45. <li>fixed missing 'jabber:client' namespaces</li>
  46. <li>&lt;service-unavailable/&gt; on managing entity &IQ; error</li>
  47. <li>forwarding in client mode is now specified</li>
  48. <li>removed wrong 'node' attribute in disco nesting example</li>
  49. <li>disco extension explicitly need to be handled</li>
  50. <li>minor typos/explanation improvments</li>
  51. </ul>
  52. </remark>
  53. </revision>
  54. <revision>
  55. <version>0.2.1</version>
  56. <date>2015-10-15</date>
  57. <initials>XEP Editor (mam)</initials>
  58. <remark><p>Corrected examples (Stefan Strigler).</p></remark>
  59. </revision>
  60. <revision>
  61. <version>0.2</version>
  62. <date>2014-03-21</date>
  63. <initials>jp</initials>
  64. <remark><p>Several updates according to feedbacks:</p>
  65. <ul>
  66. <li>Added attribute filtering, mainly to manage correctly MAM</li>
  67. <li>Simplification of configuration in admin mode: no more &IQ; negociation</li>
  68. <li>Delegations notifications to the managing entity are now done with a &MESSAGE; stanza</li>
  69. <li>Forwarding now use &xep0297; to avoid server to parse every stanza and a to have a cleaner separation</li>
  70. <li>The behaviour when managing entity is unavailable is specified</li>
  71. <li>Use of namespace in field var for client mode negociation is now mandatory</li>
  72. <li>Behaviour when managing a delegation kept between session in client mode, when managing entity is not available, is specified</li>
  73. <li>Implementation note added for in-order processing issue (thanks to Kurt Zeilenga for pointing this)</li>
  74. <li>Added an note for discovery nesting with attribute filtering</li>
  75. <li>Updated namespace to reflect incompatible changes</li>
  76. </ul>
  77. </remark>
  78. </revision>
  79. <revision>
  80. <version>0.1</version>
  81. <date>2014-12-18</date>
  82. <initials>XEP Editor (mam)</initials>
  83. <remark><p>Initial published version approved by the XMPP Council.</p></remark>
  84. </revision>
  85. <revision>
  86. <version>0.0.1</version>
  87. <date>2014-11-13</date>
  88. <initials>jp</initials>
  89. <remark><p>First draft.</p></remark>
  90. </revision>
  91. </header>
  92. <section1 topic='Introduction' anchor='intro'>
  93. <p>Some XMPP features must be offered by the server itself, or can't be available, that's the case of &xep0163; which is used in several places (e.g. bookmarks storage). But it can be desirable to use an external entity to manage some of these features, because it implements things that the server don't, or because it uses a special implementation useful in a particular case. Some people may also want to decentralize a feature on an entity under their control. This XEP try to solve these cases.<br/>Additionaly, a method to do generic treatments (independent of server) on stanza is also provided.</p>
  94. <p>This XEP is complementary to &xep0356; (and works in a similar way), although they can be used together or separately.</p>
  95. <p>Here are some use cases of namespace delegation:</p>
  96. <ul>
  97. <li>use an external component for a PEP service because the server doesn't implement it or lacks some features</li>
  98. <li>decentralize a server feature to an entity under client control</li>
  99. <li>make a component which react on new user registration, independent of server implementation</li>
  100. <li>server agnostic roster filtering</li>
  101. </ul>
  102. </section1>
  103. <section1 topic='Requirements' anchor='reqs'>
  104. <p>Namespace delegation can be used in two modes:</p>
  105. <ul>
  106. <li><strong>admin</strong> mode, where delegation is specified by the server administrator.</li>
  107. <li><strong>client</strong> mode, where it can be requested by any user.</li>
  108. </ul>
  109. <p>In <em>admin</em> mode, the managing entity manages stanza of the delegated namespace for all users registered on the server. The namespace delegation MUST be totally transparent for the managed entities.</p>
  110. <p>In <em>client</em> mode, a managing entity MUST have an explicit authorization for any namespace he wants to use. Client SHOULD be able to check and revoke granted permissions, and if it's not possible, permissions MUST be revoked after a disconnection.</p>
  111. </section1>
  112. <section1 topic='Glossary' anchor='glossary'>
  113. <ul>
  114. <li><strong>Delegated namespace</strong> — the namespace being managed by an external entity.</li>
  115. <li><strong>Filtering attribute</strong> — an attribute which must be present in first &IQ; child element to delegate the namespace.</li>
  116. <li><strong>Managing entity</strong> — the entity which actualy manages the delegated namespace.</li>
  117. <li><strong>Delegating server</strong> — the server which delegate the stanzas to the managing entity.</li>
  118. <li><strong>Managed entity</strong> — an entity which wants to have a namespace of its server delegated to a managing entity.</li>
  119. </ul>
  120. </section1>
  121. <section1 topic='Admin Mode Use Cases' anchor='admin_usecases'>
  122. <section2 topic='Server Allows Namespaces Delegations' anchor='server_config'>
  123. <p>Namespaces delegations are granted in the server configuration. Only &IQ; stanza namespaces can be delegated.</p>
  124. <p>A feature is delegated using:</p>
  125. <ol>
  126. <li>it's namespace: e.g. <em>'urn:xmpp:mam:0'</em></li>
  127. <li>zero or more filtering attribute (attributes which must be present in the initial &IQ; child element): e.g. <em>'node'</em></li>
  128. <li>the jid of the managing entity: e.g. <em>'managing.capulet.lit'</em></li>
  129. </ol>
  130. </section2>
  131. <section2 topic='Delegation Request Use Case' anchor='admin_perm'>
  132. <p>Once the managing entity is authenticated and stream is started, the server send it a &MESSAGE; stanza with a &lt;delegation/&gt; elements which MUST have the <strong>'urn:xmpp:delegation:1'</strong> namespace. This element contains &lt;delegated/&gt; elements which MUST contain a 'namespace' attribute indicating the delegated namespace. If there is additional attribute filtering, the &lt;delegated/&gt; can have children &lt;attribute/&gt; elements which MUST contain a 'name' attribute with the name of the filtering attribute.</p>
  133. <example caption='server advertise delegated namespaces'><![CDATA[
  134. <message from='capulet.lit' to='pubub.capulet.lit' id='12345'>
  135. <delegation xmlns='urn:xmpp:delegation:1'>
  136. <delegated namespace='urn:xmpp:mam:0'>
  137. <attribute name='node' />
  138. </delegated>
  139. <delegated namespace=''/>
  140. </delegation>
  141. </message>
  142. ]]></example>
  143. <p>Here <em>pubsub.capulet.lit</em> will received all stanzas of pubsub namespace sent to <em>capulet.lit</em>. It will also receive MAM stanzas, but only if the 'node' attribute is present in &QUERY;.</p>
  144. </section2>
  145. <section2 topic='Server Forwards Delegated &IQ; Stanza' anchor='stanza_forward'>
  146. <p>When a server receives a stanza for a delegated namespace which is either directed to him (no 'to' attribute, or 'to' attribute with its own JID), or directed to any bare jid (and only bare jid) that it manages (i.e. the <em>domainpart</em> is a domain handled by the server where delegation is activated), it MUST forwards it to the managing entity:</p>
  147. <example caption='Juliet sends her mood to her server via PEP'><![CDATA[
  148. <iq from='juliet@capulet.lit/balcony'
  149. id='pep1'
  150. type='set'>
  151. <pubsub xmlns=''>
  152. <publish node=''>
  153. <item>
  154. <mood xmlns=''>
  155. <annoyed/>
  156. <text>curse my nurse!</text>
  157. </mood>
  158. </item>
  159. </publish>
  160. </pubsub>
  161. </iq>
  162. ]]></example>
  163. <p>The server gets this stanza, sees that this namespace is delegated to <em>pubsub.capulet.lit</em>, so it forwards it.</p>
  164. <p>To forward, an &IQ; stanza of type "set" is used which contain a &lt;delegation/&gt; element (with namespace <em>'urn:xmpp:delegation:1'</em>) which in turn contain a &lt;forwarded/&gt; element encapsulating the initial stanza, according to &xep0297;:</p>
  165. <example caption='server delegate the stanza to pubsub.capulet.lit'><![CDATA[
  166. <iq from='capulet.lit'
  167. to='pubsub.capulet.lit'
  168. id='delegate1'
  169. type='set'>
  170. <delegation xmlns='urn:xmpp:delegation:1'>
  171. <forwarded xmlns='urn:xmpp:forward:0'>
  172. <iq from='juliet@capulet.lit/balcony'
  173. id='pep1'
  174. type='set'
  175. xmlns='jabber:client'>
  176. <pubsub xmlns=''>
  177. <publish node=''>
  178. <item>
  179. <mood xmlns=''>
  180. <annoyed/>
  181. <text>curse my nurse!</text>
  182. </mood>
  183. </item>
  184. </publish>
  185. </pubsub>
  186. </iq>
  187. </forwarded>
  188. </delegation>
  189. </iq>
  190. ]]></example>
  191. <p>The managing entity replies to the stanza by encapsulating its &IQ; result in the same way:</p>
  192. <example caption='pubsub.capulet.lit replies to juliet'><![CDATA[
  193. <iq from='pubsub.capulet.lit'
  194. to='capulet.lit'
  195. id='delegate1'
  196. type='result'>
  197. <delegation xmlns='urn:xmpp:delegation:1'>
  198. <forwarded xmlns='urn:xmpp:forward:0'>
  199. <iq to='juliet@capulet.lit/balcony'
  200. id='pep1'
  201. type='result'
  202. xmlns='jabber:client'>
  203. <pubsub xmlns='' />
  204. </iq>
  205. </forwarded>
  206. </delegation>
  207. </iq>
  208. ]]></example>
  209. <p>Then the server MUST decapsulate the &IQ; result, MUST insure that the 'to' and the 'from' attribute corresponds to respectively the 'from' and the 'to' attributes of the initial stanza, MUST insure that the 'id' attribute of the decapsulated stanza is the same as the initial 'id' attribute and that 'type' is "result". If everything is alright, it can send the decapsulated stanza to Juliet.</p>
  210. <p>If the forwarded result from managing entity is bad (i.e. wrong 'to', 'from', 'id' or 'result' attributes), the server MUST send an &IQ; error with condition &lt;service-unavailable/&gt; to managed entity, and MAY close the connexion with managing entity.</p>
  211. <example caption='capulet.lit replies to Juliet'><![CDATA[
  212. <iq to='juliet@capulet.lit/balcony'
  213. id='pep1'
  214. type='result'>
  215. <pubsub xmlns='' />
  216. </iq>
  217. ]]></example>
  218. <p>The workflow is fully transparent for Juliet.</p>
  219. <p><strong>N.B.&#8321;:</strong> If the server encounter a delegated namespace and the managing entity is not available, it MUST return an &IQ; stanza of type "error" with an error condition of &lt;service-unavailable/&gt;</p>
  220. <p><strong>N.B.&#8322;:</strong> Similarly, if the managing entity return an &IQ; stanza of type "error", the server must return itself an &IQ; stanza of type "error" with an error condition of &lt;service-unavailable/&gt;</p>
  221. <p><strong>N.B.&#8323;:</strong> If the server encounter a delegated namespace but the filtering attribute does not match, it MUST follow its normal behaviour, i.e. it must follow the same behaviour it would have had if the namespace was not delegated at all</p>
  222. <section3 topic='Stanzas from managing entity' anchor='managing_entity_stanzas'>
  223. <p>If a stanza is sent by the managing entity on a managed namespace, the server MUST NOT forward it. This way, the managing entity can use privileged entity to do specific treatments, a kind of universal plugin (i.e. working with all servers implementing &xep0355; and &xep0356;).</p>
  224. <p>In the following examples, <em>juliet@capulet.lit</em> has its "<em>jabber:iq:roster</em>" namespace delegated to <em>filter.capulet.lit</em>. <em>filter.capulet.lit</em> is a server agnostic component which filters allowed entities (which can be added to a roster), and sort them in enforced groups.</p>
  225. <example caption='Juliet adds Romeo to her roster'><![CDATA[
  226. <iq from='juliet@capulet.lit/balcony'
  227. id='roster1'
  228. type='set'>
  229. <query xmlns='jabber:iq:roster'>
  230. <item jid='romeo@montaigu.lit'
  231. name='My Romeo'>
  232. </item>
  233. </query>
  234. </iq>
  235. ]]></example>
  236. <example caption='server forwards stanza to managing entity'><![CDATA[
  237. <iq from='capulet.lit'
  238. to='pubsub.capulet.lit'
  239. id='delegate1'
  240. type='set'>
  241. <delegation xmlns='urn:xmpp:delegation:1'>
  242. <forwarded xmlns='urn:xmpp:forward:0'>
  243. <iq from='juliet@capulet.lit/balcony'
  244. id='roster1'
  245. type='set'
  246. xmlns='jabber:client'>
  247. <query xmlns='jabber:iq:roster'>
  248. <item jid='romeo@montaigu.lit'
  249. name='My Romeo'>
  250. </item>
  251. </query>
  252. </iq>
  253. </forwarded>
  254. </delegation>
  255. </iq>
  256. ]]></example>
  257. <p><em>filter.capulet.lit</em> accepts to add Romeo, but all JIDs with a <em>montaigu.lit</em> must be in a "Rivals" group, so it first returns a success result (Romeo is accepted).</p>
  258. <example caption='filtering component accept Romeo'><![CDATA[
  259. <iq from='pubsub.capulet.lit'
  260. to='capulet.lit'
  261. id='delegate1'
  262. type='result'>
  263. <delegation xmlns='urn:xmpp:delegation:1'>
  264. <forwarded xmlns='urn:xmpp:forward:0'>
  265. <iq to='juliet@capulet.lit/balcony'
  266. id='roster1'
  267. type='result'
  268. xmlns='jabber:client' />
  269. </forwarded>
  270. </delegation>
  271. </iq>
  272. ]]></example>
  273. <example caption='server decapsulate and send the result with the initial id'><![CDATA[
  274. <iq to='juliet@capulet.lit/balcony'
  275. id='roster1'
  276. type='result' />
  277. ]]></example>
  278. <p>At this stade, the entity is accepted, but not added to the roster. <em>filter.capulet.lit</em> is also a privileged entity which can manage "<em>jabber:iq:roster</em>", so it uses this ability to add Romeo in the enforced group:</p>
  279. <example caption='filter.capulet.lit uses privileged entity to add Romeo'><![CDATA[
  280. <iq to='juliet@capulet.lit'
  281. from='filter.capulet.lit'
  282. id='roster2'
  283. type='set'>
  284. <query xmlns='jabber:iq:roster'>
  285. <item jid='romeo@montaigu.lit'
  286. name='My Romeo'>
  287. <group>Rivals</group>
  288. </item>
  289. </query>
  290. </iq>
  291. ]]></example>
  292. <p>The namespace is delegated, but as the stanza is from the managing entity, the server manages it normally. The entity is also privileged, so it can change the stanza of Juliet, the server accepts:</p>
  293. <example caption='server accept new entity in roster'><![CDATA[
  294. <iq to='filter.capulet.lit'
  295. from='juliet@capulet.lit'
  296. id='roster2'
  297. type='result'/>
  298. ]]></example>
  299. <p>The server will then send the roster pushes (with the enforced group) normally.</p>
  300. </section3>
  301. </section2>
  302. </section1>
  303. <section1 topic='Client Mode Use Cases' anchor='client_usecases'>
  304. <section2 topic='Client Delegation Request Use Case' anchor='client_delegation'>
  305. <p>In <em>client</em> mode, the managing entity is not certified by the server administrator, so the delegation MUST be <strong>explicitly</strong> allowed by the managed entity. This is initiated by the managing entity (it can be after an interaction with a managed entity, like a subscription).</p>
  306. <p>To request delegation for a particular entity, the managing entity MUST have an &IQ; stanza with <em>'urn:xmpp:delegation:1'</em> namespace. The &QUERY; element MUST have a 'to' attribute which specify the entity it wants to manage.</p>
  307. <p>Namespace delegations are asked with a &lt;delegate/&gt; element, which MUST contain a 'namespace' attribute set to the requested namespace.</p>
  308. <p>If an entity want to manage PEP service for Juliet, it can ask the delegation like this:
  309. </p>
  310. <example caption='managing entity asks for namespace delegation for one particular entity'><![CDATA[
  311. <iq from='pubsub.montaigu.lit' to='capulet.lit' type='get' id='delegation1'>
  312. <query xmlns='urn:xmpp:delegation:1'
  313. to='juliet@capulet.lit'>
  314. <delegate namespace=''/>
  315. </query>
  316. </iq>
  317. ]]></example>
  318. <p>Once received the delegation request, the server ask to the client if it grants access to the requested namespace using &xep0004;. The server use a challenge which it MUST have generated itself.
  319. </p>
  320. <example caption='server asks user for the namespace delegation'><![CDATA[
  321. <message from='capulet.lit' to='juliet@capulet.lit/balcony'>
  322. <body>
  323. pubsub.montaigu.lit wants to manage a feature normally managed by the server.
  324. Do you allow it to manage the following features?
  325. Be careful! According management to an entity is a serious thing,
  326. think twice that you can trust the entity before doing this.
  327. </body>
  328. <x xmlns='jabber:x:data' type='form'>
  329. <title>Delegation request</title>
  330. <instructions>pubsub.montaigu.lit wants to manage the following features:
  331. Do you allow it?</instructions>
  332. <field type='hidden' var='challenge'><value>5439123</value></field>
  333. <field type='hidden' var='FORM_TYPE'>
  334. <value>urn:xmpp:delegation:1</value>
  335. </field>
  336. <field type='list-single'
  337. label='Manage PubSub ('
  338. var=''>
  339. <value>0</value>
  340. <option label='No'><value>0</value></option>
  341. <option label='Yes'><value>1</value></option>
  342. </field>
  343. </x>
  344. </message>
  345. ]]></example>
  346. <p>The server SHOULD include a warning message, SHOULD translate the namespace to human friendly names (and MAY keep the original namespace in addition) and MUST set the default value to '<strong>0</strong>' (permission refused). The server MUST use namespaces as field var, so a client can use them to have a customized display.</p>
  347. <p>The client can then answer to the form:</p>
  348. <example caption='client answer to the form'><![CDATA[
  349. <message from='juliet@capulet.lit/balcony' to='capulet.lit'>
  350. <x xmlns='jabber:x:data' type='submit'>
  351. <field var='FORM_TYPE'>
  352. <value></value>
  353. </field>
  354. <field var='challenge'><value>5439123</value></field>
  355. <field var=''><value>1</value></field>
  356. </x>
  357. </message>
  358. ]]></example>
  359. <p>Here Juliet allows <em>pubsub.montaigu.lit</em> to manage the PubSub (and then PEP) service.</p>
  360. <p>Finaly, the server notifies the entity of the granted delegation. It do this in the same way as for <link url='#admin_perm'>admin mode</link>, except that the &lt;delegation/&gt; element has an attitional 'to' attribute set to the managed entity bare jid:</p>
  361. <example caption='server advertise delegated namespaces for juliet'><![CDATA[
  362. <message from='' to='pubub.capulet.lit' id='6789'>
  363. <delegation xmlns='urn:xmpp:delegation:1' to='juliet@capulet.lit'>
  364. <delegated namespace=''/>
  365. </delegation>
  366. </message>
  367. ]]></example>
  368. </section2>
  369. <section2 topic='Server Forward Stanza' anchor='client_forward'>
  370. <p>The managing entity can now manage the namespace in a similar way as in <link url='#stanza_forward'>admin mode</link> but with different rules:</p>
  371. <ol>
  372. <li>if the stanza is directed to the delegating server (no 'to' attribute, or 'to' attribute with the server own JID), <strong>and</strong> the 'from' attribute belong to a managed entity (e.g. <em>juliet@capulet.lit/balcony</em> if <em>juliet@capulet.lit</em> is a managed entity) <strong>and</strong> the namespace of the stanza has been delegated by the managed entity, then the delegating server MUST forward it to the managing entity accepted by the managed entity, in the same way as in <link url='#stanza_forward'>admin mode</link>.</li>
  373. <li>if the stanza is directed to the bare jid (and only the bare jid) of the managed entity (e.g. the 'to' attribute is set to <em>juliet@capulet.lit</em> and the namespace has been delegated by the managed entity, then the server MUST forward it to the managing entity accepted by the managed entity, in the same way as in <link url='#stanza_forward'>admin mode</link>, for any 'from' attribute but the jid of the managing entity.</li>
  374. <li>in all other cases, the server MUST NOT forward the stanza</li>
  375. </ol>
  376. </section2>
  377. </section1>
  378. <section1 topic='Configuration' anchor='configuration'>
  379. <p>Server SHOULD provide a way for clients to check already delegated namespaces, and revoke them by using &xep0050; on the well-defined command node <strong>'urn:xmpp:delegation:1#configure'</strong>.</p>
  380. <p>If present, the configuration commands MUST allow at least to check delegations granted to a managing entity, and to revoke them. A server MAY offer an option to keep delegations from one session to an other (see <link url='#rules'>business rules</link>).</p>
  381. </section1>
  382. <section1 topic='Discovering Support' anchor='disco'>
  383. <section2 topic='Announce' anchor='disco_announce'>
  384. <p>If a server or an entity supports the namespace delegation protocol, it MUST report that fact by including a service discovery feature of "<em>urn:xmpp:delegation:1</em>" in response to a &xep0030; information request:</p>
  385. <example caption="service discovery information request"><![CDATA[
  386. <iq from='pubsub.capulet.lit'
  387. id='disco1'
  388. to='capulet.lit'
  389. type='get'>
  390. <query xmlns=''/>
  391. </iq>
  392. ]]></example>
  393. <example caption="service discovery information response"><![CDATA[
  394. <iq from='capulet.lit'
  395. id='disco1'
  396. to='pubsub.capulet.lit'
  397. type='result'>
  398. <query xmlns=''>
  399. ...
  400. <feature var='urn:xmpp:delegation:1'/>
  401. ...
  402. </query>
  403. </iq>
  404. ]]></example>
  405. </section2>
  406. <section2 topic='Nesting' anchor='disco_nesting'>
  407. <section3 topic='General Case'>
  408. <p>When a server delegates a namespace to a managing entity, the later can have particular features which must be advertised by the former with disco protocol.</p>
  409. <p>This is done by using a disco node, which is built in the following way: if manages pubsub namespace, it MUST report that fact in discovery feature, and have a '<strong>urn:xmpp:delegation:1::</strong>' node which reports the managed features.</p><p>The node name is obtained by concatenating this XEP namespace (<strong>urn:xmpp:delegation:1</strong>), a '<strong>::</strong>' separator, and the delegated namespace (here <strong></strong>).<br/>The server MUST advertise the result in its own discovery answer, and MUST ignore features of its internal component (here internal PubSub service).</p>
  410. <p>In the following example, the server delegates its internal PEP component to only supports REQUIRED PubSub features and auto-create, while supports REQUIRED PubSub features and publish-options, but not auto-create. <br/> asks its server what it is capable of, she is specially interested in PubSub capabilities.</p>
  411. <example caption="Juliet asks her server its available features"><![CDATA[
  412. <iq from='juliet@capulet.lit/balcony'
  413. id='disco1'
  414. to='capulet.lit'
  415. type='get'>
  416. <query xmlns=''/>
  417. </iq>
  418. ]]>
  419. </example>
  420. <p>Server delegates its PubSub namespace to <em>pubsub.capulet.lit</em>, so it asks its available features for this namespace like this:</p>
  421. <example caption="capulet.lit requests disco infos for pubsub namespace to pubsub.capulet.lit"><![CDATA[
  422. <iq from='capulet.lit'
  423. id='disco2'
  424. to='pubsub.capulet.lit'
  425. type='get'>
  426. <query xmlns=''
  427. node='urn:xmpp:delegation:1::'/>
  428. </iq>
  429. ]]>
  430. </example>
  431. <p>Note that in real situation, server has probably this information already in cache (see <link url='#impl'>Implementation Notes</link>).<br/>
  432. <em>pubsub.capulet.lit</em> returns its available features:</p>
  433. <example caption="pubsub.capulet.lit returns features to nest"><![CDATA[
  434. <iq from='pubsub.capulet.lit'
  435. id='disco2'
  436. to='capulet.lit'
  437. type='result'>
  438. <query xmlns=''
  439. node='urn:xmpp:delegation:1::'>
  440. <feature var=''/>
  441. <feature var=''/>
  442. <feature var=''/>
  443. <feature var=''/>
  444. </query>
  445. </iq>
  446. ]]>
  447. </example>
  448. <p>Server include the results in its own discovery info results:</p>
  449. <example caption="capulet.lit return disco info including features from pubsub.capulet.lit"><![CDATA[
  450. <iq from='capulet.lit'
  451. id='disco1'
  452. to='juliet@capulet.lit/balcony'
  453. type='result'>
  454. <query xmlns=''>
  455. <feature var='urn:xmpp:delegation:1'/>
  456. ...
  457. <feature var=''/>
  458. <feature var=''/>
  459. <feature var=''/>
  460. <feature var=''/>
  461. ...
  462. </query>
  463. </iq>
  464. ]]>
  465. </example>
  466. <p>Note that '<em></em>' is not available.</p>
  467. <p><strong>N.B.:</strong> In the special case of attribute filtering, the server still display managing entity's features for the whole delegated namespace instead of its own internal ones.</p>
  468. </section3>
  469. <section3 topic='Rediction Of Bare JID Disco Info'>
  470. <p>As an entity may ask for discovery information on bare JID, which the server would answer, the managing entity must be able to send this kind of information.</p>
  471. <p>To do so, the mechanism is the same as for server features, but the separator is '<strong>:bare:</strong>' instead of '<strong>::</strong>':</p>
  472. <example caption="Juliet asks features for its own bare JID"><![CDATA[
  473. <iq from='juliet@capulet.lit/balcony'
  474. id='disco3'
  475. to='juliet@capulet.lit'
  476. type='get'>
  477. <query xmlns=''/>
  478. </iq>
  479. ]]>
  480. </example>
  481. <p>Server delegate its PubSub namespace to <em>pubsub.capulet.lit</em>, so it ask its available features for this namespace like this:</p>
  482. <example caption="capulet.lit requests disco infos for pubsub namespace to pubsub.capulet.lit"><![CDATA[
  483. <iq from='capulet.lit'
  484. id='disco4'
  485. to='pubsub.capulet.lit'
  486. type='get'>
  487. <query xmlns=''
  488. node='urn:xmpp:delegation:1:bare:'/>
  489. </iq>
  490. ]]>
  491. </example>
  492. <p>As for general case, server has probably <link url='#impl'>this information already in cache</link>.<br/>
  493. <em>pubsub.capulet.lit</em> returns its available features:</p>
  494. <example caption="pubsub.capulet.lit returns features to nest"><![CDATA[
  495. <iq from='pubsub.capulet.lit'
  496. id='disco4'
  497. to='capulet.lit'
  498. type='result'>
  499. <query xmlns=''
  500. node='urn:xmpp:delegation:1:bare:'>
  501. <identity category='pubsub' type='pep'/>
  502. <feature var=''/>
  503. <feature var=''/>
  504. <feature var=''/>
  505. <feature var=''/>
  506. <feature var=''/>
  507. <feature var=''/>
  508. <feature var=''/>
  509. <feature var=''/>
  510. <feature var=''/>
  511. <feature var=''/>
  512. <feature var=''/>
  513. ...
  514. </query>
  515. </iq>
  516. ]]>
  517. </example>
  518. <p>Then the server returns the answer to Juliet, as in general case, with requested bare JID in 'from' field.</p>
  519. <example caption="capulet.lit returns disco info to Juliet"><![CDATA[
  520. <iq from='juliet@capulet.lit'
  521. id='disco3'
  522. to='juliet@capulet.lit/balcony'
  523. type='result'>
  524. <query xmlns=''>
  525. <identity category='account' type='registered'/>
  526. <identity category='pubsub' type='pep'/>
  527. <feature var=''/>
  528. <feature var=''/>
  529. <feature var=''/>
  530. <feature var=''/>
  531. <feature var=''/>
  532. <feature var=''/>
  533. <feature var=''/>
  534. <feature var=''/>
  535. <feature var=''/>
  536. <feature var=''/>
  537. <feature var=''/>
  538. ...
  539. </query>
  540. </iq>
  541. ]]>
  542. </example>
  543. </section3>
  544. <section3 topic='Service Discovery Extensions'>
  545. <p>Extensions of Service Discovery as specified in &xep0128; follow the same rules: for the delegated namespace, internal extensions MUST be removed and extensions of managing entity MUST be included instead.</p>
  546. </section3>
  547. </section2>
  548. </section1>
  549. <section1 topic='Business Rules' anchor='rules'>
  550. <ol>
  551. <li>In client mode, server MAY keep delegations granted to an entity by a client from one session to an other, but if it does so, it MUST provide configuration like explained in the <link url='#configuration'>suitable section</link>. If server offers this feature, it SHOULD add a field directly in configuration commands.</li>
  552. <li>If a client can't check or revoke delegations (i.e. it doesn't support &xep0050;) when granting them, the server MUST NOT keep granted delegations from one session to an other, and delegations will be asked on each new session.</li>
  553. <li>If delegations are changed during a session, server MUST notify managing entity of the new delegations, like in <link url='#client_delegation'>client delegation request use case</link>.</li>
  554. <li>If delegations are kept between sessions in client mode, and the managing entity is not available or return an error, the server MUST return an &IQ; error with condition &lt;service-unavailable/&gt; when a delegated namespace is requested, like explained in <link url='#stanza_forward'>"Server Forwards Delegated &IQ; Stanza" section</link>.</li>
  555. <li>The namespace of this XEP (<strong>urn:xmpp:delegation:1</strong>) MUST NOT be delegated. If an entity requests it, the server MUST return a &forbidden; error.</li>
  556. </ol>
  557. </section1>
  558. <section1 topic='Implementation Notes' anchor='impl'>
  559. <ol>
  560. <li>As admin mode is far more easy to implement than client mode, and client mode may impact performances, a server MAY choose to only implement the former.</li>
  561. <li>Because of the performance impact, a server SHOULD ask for <link url='#disco_nesting'>disco features to nest</link> to managing entity when delegation is accepted, and keep them in cache.</li>
  562. <li>&rfc6120; section 10.1 require in-order processing of stanzas, which may be problematic for this extension: either the server blocks the traffic until the managing entity answer - which can lead to severe performance impact -, or the server doesn't block and may loose order. The recommended way is to not block the traffic while waiting for managing entity answer to avoid performance issues. A future version of this XEP may include an attribute to request traffic blocking. In admin mode the server implementation MAY chooses to have a blocking option (which SHOULD be per namespace, not global).
  563. </li>
  564. </ol>
  565. </section1>
  566. <section1 topic='Security Considerations' anchor='security'>
  567. <ol>
  568. <li>Managing entity can manage sensitive data, <em>admin</em> delegation should be granted carefuly, only if you absolutely trust the entity.</li>
  569. <li>A server MAY choose to filter allowed namespaces. In this case, it MUST always set the allowed type of filtered namespaces to <strong>0</strong>.</li>
  570. <li>In case of filtering, a whitelist system is more secure and SHOULD be prefered to a blacklist (idealy, configuration would allow no filtering, whitelist filtering and blacklist filtering).</li>
  571. </ol>
  572. </section1>
  573. <section1 topic='IANA Considerations' anchor='iana'>
  574. <p>This document requires no interaction with &IANA;.</p>
  575. </section1>
  576. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  577. <section2 topic='Protocol Namespaces' anchor='ns'>
  578. <p>The &REGISTRAR; includes 'urn:xmpp:delegation:1' in its registry of protocol namespaces (see &NAMESPACES;).</p>
  579. <ul>
  580. <li>urn:xmpp:delegation:1</li>
  581. </ul>
  582. </section2>
  583. <section2 topic='Protocol Versioning' anchor='registrar-versioning'>
  584. &NSVER;
  585. </section2>
  586. </section1>
  587. <section1 topic='XML Schema' anchor='schema'>
  588. <code><![CDATA[
  589. <?xml version='1.0' encoding='UTF-8'?>
  590. <xs:schema
  591. xmlns:xs=''
  592. targetNamespace='urn:xmpp:delegation:1'
  593. xmlns='urn:xmpp:delegation:1'
  594. elementFormDefault='qualified'>
  595. <xs:import namespace='urn:xmpp:forward:0'
  596. schemaLocation=''/>
  597. <xs:element name='query'>
  598. <xs:complexType>
  599. <xs:attribute name='to' use='required' type='xs:string'/>
  600. </xs:attribute>
  601. <xs:element name='delegate'
  602. maxOccurs='unbounded'>
  603. <xs:complexType>
  604. <xs:attribute name='namespace' use='required' type='xs:string'/>
  605. </xs:complexType>
  606. </xs:element>
  607. </xs:complexType>
  608. </xs:element>
  609. <xs:element name='delegation'>
  610. <xs:complexType>
  611. <xs:element ref='urn:xmpp:forward:0' minOccurs='0' maxOccurs='1' />
  612. <xs:element name='delegated'
  613. minOccurs='0'
  614. maxOccurs='unbounded'>
  615. <xs:complexType>
  616. <xs:attribute name='namespace' use='required' type='xs:string'/>
  617. <xs:element name='attribute'
  618. minOccurs='0'
  619. maxOccurs='unbounded'>
  620. <xs:complexType>
  621. <xs:attribute name='name' use='required' type='xs:string'/>
  622. </xs:complexType>
  623. </xs:element>
  624. </xs:complexType>
  625. </xs:element>
  626. </xs:complexType>
  627. </xs:element>
  628. </xs:schema>
  629. ]]></code>
  630. </section1>
  631. <section1 topic='Acknowledgements' anchor='acks'>
  632. <p>This XEP is linked with &xep0356; and works in a similar way.</p>
  633. <p>The client mode delegation mechanism is inspired from &xep0321; permission request.</p>
  634. <p>Thanks to Adrien Cossa for his typos/style corrections</p>
  635. <p>Thanks to Philipp Hancke, Dave Cridland, Kurt Zeilenga, Sergey Dobrov and Анна Мухаррам for their feedbacks.</p>
  636. </section1>
  637. </xep>