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-0193.xml 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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>Proposed Resource Binding Improvements</title>
  10. <abstract>This document proposes improvements to the definition of resource binding for inclusion in the specification that supersedes RFC 3920.</abstract>
  11. &LEGALNOTICE;
  12. <number>0193</number>
  13. <status>Obsolete</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. </dependencies>
  19. <supersedes/>
  20. <supersededby/>
  21. <shortname>N/A</shortname>
  22. &stpeter;
  23. <revision>
  24. <version>1.2</version>
  25. <date>2012-02-08</date>
  26. <initials>psa</initials>
  27. <remark><p>Per a vote of the XMPP Council, changed status from Deprecated to Obsolete.</p></remark>
  28. </revision>
  29. <revision>
  30. <version>1.1</version>
  31. <date>2011-05-11</date>
  32. <initials>psa</initials>
  33. <remark><p>Per a vote of the XMPP Council, changed specification to Deprecated because the recommendations described in this document were not incorporated into RFC 6120.</p></remark>
  34. </revision>
  35. <revision>
  36. <version>1.0</version>
  37. <date>2007-01-17</date>
  38. <initials>psa</initials>
  39. <remark><p>Per a vote of the XMPP Council, advanced specification to Draft.</p></remark>
  40. </revision>
  41. <revision>
  42. <version>0.3</version>
  43. <date>2007-01-09</date>
  44. <initials>psa</initials>
  45. <remark><p>Per Council feedback, modified error handling when client does not include a from address; also, clarified rules regarding which full JID to include on bind and unbind requests.</p></remark>
  46. </revision>
  47. <revision>
  48. <version>0.2</version>
  49. <date>2007-01-02</date>
  50. <initials>psa</initials>
  51. <remark><p>Required client to include from address on every stanza it sends over a stream to which it has bound multiple resources; specified server handling of sessions.</p></remark>
  52. </revision>
  53. <revision>
  54. <version>0.1</version>
  55. <date>2006-08-16</date>
  56. <initials>psa</initials>
  57. <remark><p>Initial version.</p></remark>
  58. </revision>
  59. <revision>
  60. <version>0.0.2</version>
  61. <date>2006-08-15</date>
  62. <initials>psa</initials>
  63. <remark><p>Added stream feature for unbind.</p></remark>
  64. </revision>
  65. <revision>
  66. <version>0.0.1</version>
  67. <date>2006-08-15</date>
  68. <initials>psa</initials>
  69. <remark><p>First draft.</p></remark>
  70. </revision>
  71. </header>
  72. <section1 topic='Introduction' anchor='proto'>
  73. <p><cite>RFC 3920</cite> introduced the concept of binding a resource to an XML stream (this concept superseded part of the obsolete jabber:iq:auth protocol described in &xep0078;). As defined in <cite>RFC 3920</cite>, resource binding enables a client to bind one resource to a stream but does not enable a client to unbind a resource and leaves underspecified what a server and client should do if a client binds more than one resource to a stream. Because the ability to bind multiple resources to a stream is desirable in certain environments (e.g., for devices that are unable to open more than one TCP connection or when a machine runs a daemon process that is used by multiple applications), this document proposes improvements to resource binding in order to address these shortcomings.</p>
  74. <p class='box'>Note: The recommendations from this document were NOT incorporated into &rfc6120; and this document is Obsolete.</p>
  75. </section1>
  76. <section1 topic='Unbinding a Resource' anchor='unbind'>
  77. <p>In order to properly manage the resources associated with an XML stream, a client must be able to unbind resources. This shall be completed by sending an IQ-set with a child element of &lt;unbind/&gt; qualified by the 'urn:ietf:params:xml:ns:xmpp-bind' namespace, which in turn has a child element of &lt;resource/&gt; whose XML character data specifies the resource to be unbound:</p>
  78. <code><![CDATA[
  79. <iq from='someid@domain.tld/someresource' type='set' id='bind_2'>
  80. <unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
  81. <resource>someresource</resource>
  82. </unbind>
  83. </iq>
  84. ]]></code>
  85. <p>If the server does not understand the &lt;unbind/&gt; element, it MUST return an error of &badrequest;. Otherwise, if there is no such resource, the server MUST return an error of &notfound;. When the client unbinds the only resource associated with the stream, the server SHOULD close the stream and terminate the TCP connection. The 'from' address included in bind and unbind stanzas SHOULD be the full JID &LOCALFULL; associated with the resource in question; however, the server MUST NOT accept further stanzas from that full JID after successfully processing the unbind request.</p>
  86. <p>A server SHOULD advertise its support for the 'urn:ietf:params:xml:ns:xmpp-bind' namespace and the unbind functionality by returning an appropriate stream feature as shown below:</p>
  87. <code><![CDATA[
  88. <stream:features>
  89. <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
  90. <required/>
  91. </bind>
  92. <unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
  93. </stream:features>
  94. ]]></code>
  95. </section1>
  96. <section1 topic='Business Rules' anchor='bizrules'>
  97. <section2 topic='From Addresses' anchor='from'>
  98. <p>When a client binds multiple resources to the same stream, proper management of 'from' addresses is imperative. In particular, a client MUST specify a 'from' address on every stanza it sends over a stream to which it has bound multiple resources, where the 'from' address is the full JID &LOCALFULL; associated with the relevant resource. If a client does not specify a 'from' address on a stanza it sends over a stream to which it has bound multiple resources (or if it specifies as the 'from' address a full JID other than one of the bound resources), the server MUST return the stanza to the client with an &lt;unknown-sender/&gt; stanza error. <note>Currently there is no &lt;unknown-sender/&gt; stanza defined in <cite>RFC 3920</cite>. The author will work to add such an error condition (with a type of "modify") to the document that revises <cite>RFC 3920</cite>.</note></p>
  99. <p>Naturally, the existing rules from <cite>RFC 3920</cite> regarding validation of asserted 'from' addresses still apply.</p>
  100. </section2>
  101. <section2 topic='Server Sessions' anchor='sessions'>
  102. <p>In instant messaging and presence applications, an XMPP server manages a session on behalf of a connected client. A server MUST create and manage a separate session for each distinct resource, even if there are multiple resources associated with a given XML stream. In particular:</p>
  103. <ol>
  104. <li>A server MUST consider each resource to be a distinct source of presence information, both with regard to presence notifications and with regard to presence probes.</li>
  105. <li>A server MUST manage rosters (see <cite>RFC 3920</cite>) and &xep0016; separately for each resource.</li>
  106. </ol>
  107. </section2>
  108. </section1>
  109. <section1 topic='Examples' anchor='examples'>
  110. <p>The following examples show a possible flow of resource binding and unbinding (stanzas prefixed by "C:" are sent by the client, stanzas prefixed by "S:" are sent by the server).</p>
  111. <p>First, the client binds an initial resource to the stream.</p>
  112. <example caption='Binding an Initial Resource'><![CDATA[
  113. C: <iq from='juliet@capulet.com/core' type='set' id='bind-1'>
  114. <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
  115. <resource>core</resource>
  116. </bind>
  117. </iq>
  118. S: <iq to='juliet@capulet.com/core' type='result' id='bind-1'>
  119. <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
  120. <jid>juliet@capulet.com/core</jid>
  121. </bind>
  122. </iq>
  123. ]]></example>
  124. <p>Now the client sends some stanzas, making sure to set its 'from' address:</p>
  125. <example caption='Sending Some Stanzas'><![CDATA[
  126. C: <iq from='juliet@capulet.com/core' type='get' id='roster-1'>
  127. <query xmlns='jabber:iq:roster'/>
  128. </iq>
  129. S: <iq to='juliet@capulet.com/core' type='result' id='roster-1'>
  130. <query xmlns='jabber:iq:roster'>
  131. <item jid='romeo@montague.net'/>
  132. </query>
  133. </iq>
  134. C: <presence from='juliet@capulet.com/core'/>
  135. ]]></example>
  136. <p>Now the client binds a second resource to the stream.</p>
  137. <example caption='Binding a Second Resource'><![CDATA[
  138. C: <iq from='juliet@capulet.com/balcony' type='set' id='bind-2'>
  139. <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
  140. <resource>balcony</resource>
  141. </bind>
  142. </iq>
  143. S: <iq to='juliet@capulet.com/balcony' type='result' id='bind-2'>
  144. <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
  145. <jid>juliet@capulet.com/balcony</jid>
  146. </bind>
  147. </iq>
  148. ]]></example>
  149. <p>If the server does not allow entities to bind multiple resources to the stream, it MUST return a &notallowed; error as described in <cite>RFC 3920</cite>.</p>
  150. <p>Now the client sends more stanzas.</p>
  151. <example caption='Sending More Stanzas'><![CDATA[
  152. C: <iq from='juliet@capulet.com/balcony' type='get' id='roster-2'>
  153. <query xmlns='jabber:iq:roster'/>
  154. </iq>
  155. C: <iq to='juliet@capulet.com/balcony' type='result' id='roster-2'>
  156. <query xmlns='jabber:iq:roster'>
  157. <item jid='romeo@montague.net'/>
  158. </query>
  159. </iq>
  160. C: <presence from='juliet@capulet.com/balcony'/>
  161. C: <message to='romeo@montague.net'>
  162. <body>Wherefore art thou?</body>
  163. </message>
  164. S: <message type='error'>
  165. <body>Wherefore art thou?</body>
  166. <error type='modify'>
  167. <unknown-sender xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  168. </error>
  169. </message>
  170. ]]></example>
  171. <p>In handling the last stanza shown above, the server returns an &lt;unknown-sender/&gt; error to the sender because the sender did not include a 'from' address.</p>
  172. <p>Now the client binds a third resource to the stream.</p>
  173. <example caption='Binding a Third Resource'><![CDATA[
  174. C: <iq from='juliet@capulet.com/softphone' type='set' id='bind-3'>
  175. <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
  176. <resource>softphone</resource>
  177. </bind>
  178. </iq>
  179. S: <iq to='juliet@capulet.com/softphone' type='result' id='bind-3'>
  180. <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
  181. <jid>juliet@capulet.com/softphone</jid>
  182. </bind>
  183. </iq>
  184. ]]></example>
  185. <p>Now the client unbinds its initial resource.</p>
  186. <example caption='Unbinding a Resource'><![CDATA[
  187. C: <iq from='juliet@capulet.com/core' type='set' id='unbind-1'>
  188. <unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
  189. <resource>core</resource>
  190. </unbind>
  191. </iq>
  192. S: <iq from='juliet@capulet.com/core' type='result' id='unbind-1'/>
  193. ]]></example>
  194. <p>Now the client unbinds another resource.</p>
  195. <example caption='Unbinding a Resource'><![CDATA[
  196. C: <iq from='juliet@capulet.com/softphone' type='set' id='unbind-2'>
  197. <unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
  198. <resource>softphone</resource>
  199. </unbind>
  200. </iq>
  201. S: <iq to='juliet@capulet.com/softphone' type='result' id='unbind-2'/>
  202. ]]></example>
  203. <p>Now the client unbinds its last remaining resource.</p>
  204. <example caption='Unbinding the Final Resource'><![CDATA[
  205. C: <iq from='juliet@capulet.com/balcony' type='set' id='unbind-3'>
  206. <unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
  207. <resource>balcony</resource>
  208. </unbind>
  209. </iq>
  210. S: <iq to='juliet@capulet.com/balcony' type='result' id='unbind-3'/>
  211. ]]></example>
  212. <p>The server now SHOULD close the stream and terminate the underlying TCP connection.</p>
  213. <example caption='Server Closes the Stream'><![CDATA[
  214. S: </stream:stream>
  215. ]]></example>
  216. </section1>
  217. <section1 topic='Security Considerations' anchor='security'>
  218. <p>If properly implemented, the modifications described herein do not introduce any new security concerns above and beyond those defined in <cite>RFC 3920</cite>. However, care must be taken to properly manage 'from' addresses in order to avoid the delivery of stanzas from an unintended resource (which may, for example, leak presence information).</p>
  219. </section1>
  220. <section1 topic='IANA Considerations' anchor='iana'>
  221. <p>No interaction with &IANA; is required as a result of this document.</p>
  222. </section1>
  223. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  224. <p>No interaction with the &REGISTRAR; is required as a result of this document, since the 'urn:ietf:params:xml:ns:xmpp-bind' namespace is already registered (see &NAMESPACES;).</p>
  225. </section1>
  226. <section1 topic='XML Schema' anchor='schema'>
  227. <p>Note: The following provisional schema is intended to replace the existing schema for the Resource Binding stream feature.</p>
  228. <code><![CDATA[
  229. <?xml version='1.0' encoding='UTF-8'?>
  230. <xs:schema
  231. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  232. targetNamespace='urn:ietf:params:xml:ns:xmpp-bind'
  233. xmlns='urn:ietf:params:xml:ns:xmpp-bind'
  234. elementFormDefault='qualified'>
  235. <xs:element name='bind'>
  236. <xs:complexType>
  237. <xs:sequence>
  238. <xs:choice minOccurs='0' maxOccurs='1'>
  239. <xs:element name='resource' type='resourceType'/>
  240. <xs:element name='jid' type='fullJIDType'/>
  241. </xs:choice>
  242. <xs:element name='required'
  243. minOccurs='0'
  244. maxOccurs='1'
  245. type='empty'/>
  246. </xs:choice>
  247. </xs:sequence>
  248. </xs:complexType>
  249. </xs:element>
  250. <xs:element name='unbind'>
  251. <xs:complexType>
  252. <xs:sequence minOccurs='0'>
  253. <xs:element name='resource' type='resourceType'/>
  254. </xs:sequence>
  255. </xs:complexType>
  256. </xs:element>
  257. <xs:simpleType name='resourceType'>
  258. <xs:restriction base='xs:string'>
  259. <xs:minLength value='1'/>
  260. <xs:maxLength value='1023'/>
  261. </xs:restriction>
  262. </xs:simpleType>
  263. <xs:simpleType name='fullJIDType'>
  264. <xs:restriction base='xs:string'>
  265. <xs:minLength value='8'/>
  266. <xs:maxLength value='3071'/>
  267. </xs:restriction>
  268. </xs:simpleType>
  269. </xs:schema>
  270. ]]></code>
  271. </section1>
  272. </xep>