forked from xsf/xeps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxep-0193.xml
291 lines (273 loc) · 13.6 KB
/
xep-0193.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Proposed Resource Binding Improvements</title>
<abstract>This document proposes improvements to the definition of resource binding for inclusion in the specification that supersedes RFC 3920.</abstract>
&LEGALNOTICE;
<number>0193</number>
<status>Obsolete</status>
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>N/A</shortname>
&stpeter;
<revision>
<version>1.2</version>
<date>2012-02-08</date>
<initials>psa</initials>
<remark><p>Per a vote of the XMPP Council, changed status from Deprecated to Obsolete.</p></remark>
</revision>
<revision>
<version>1.1</version>
<date>2011-05-11</date>
<initials>psa</initials>
<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>
</revision>
<revision>
<version>1.0</version>
<date>2007-01-17</date>
<initials>psa</initials>
<remark><p>Per a vote of the XMPP Council, advanced specification to Draft.</p></remark>
</revision>
<revision>
<version>0.3</version>
<date>2007-01-09</date>
<initials>psa</initials>
<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>
</revision>
<revision>
<version>0.2</version>
<date>2007-01-02</date>
<initials>psa</initials>
<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>
</revision>
<revision>
<version>0.1</version>
<date>2006-08-16</date>
<initials>psa</initials>
<remark><p>Initial version.</p></remark>
</revision>
<revision>
<version>0.0.2</version>
<date>2006-08-15</date>
<initials>psa</initials>
<remark><p>Added stream feature for unbind.</p></remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2006-08-15</date>
<initials>psa</initials>
<remark><p>First draft.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='proto'>
<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>
<p class='box'>Note: The recommendations from this document were NOT incorporated into &rfc6120; and this document is Obsolete.</p>
</section1>
<section1 topic='Unbinding a Resource' anchor='unbind'>
<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 <unbind/> qualified by the 'urn:ietf:params:xml:ns:xmpp-bind' namespace, which in turn has a child element of <resource/> whose XML character data specifies the resource to be unbound:</p>
<code><![CDATA[
<iq from='[email protected]/someresource' type='set' id='bind_2'>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>someresource</resource>
</unbind>
</iq>
]]></code>
<p>If the server does not understand the <unbind/> element, it MUST return an error of &badrequest;. Otherwise, if there is no such resource, the server MUST return an error of ¬found;. 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>
<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>
<code><![CDATA[
<stream:features>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<required/>
</bind>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
</stream:features>
]]></code>
</section1>
<section1 topic='Business Rules' anchor='bizrules'>
<section2 topic='From Addresses' anchor='from'>
<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 <unknown-sender/> stanza error. <note>Currently there is no <unknown-sender/> 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>
<p>Naturally, the existing rules from <cite>RFC 3920</cite> regarding validation of asserted 'from' addresses still apply.</p>
</section2>
<section2 topic='Server Sessions' anchor='sessions'>
<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>
<ol>
<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>
<li>A server MUST manage rosters (see <cite>RFC 3920</cite>) and &xep0016; separately for each resource.</li>
</ol>
</section2>
</section1>
<section1 topic='Examples' anchor='examples'>
<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>
<p>First, the client binds an initial resource to the stream.</p>
<example caption='Binding an Initial Resource'><![CDATA[
C: <iq from='[email protected]/core' type='set' id='bind-1'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>core</resource>
</bind>
</iq>
S: <iq to='[email protected]/core' type='result' id='bind-1'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>[email protected]/core</jid>
</bind>
</iq>
]]></example>
<p>Now the client sends some stanzas, making sure to set its 'from' address:</p>
<example caption='Sending Some Stanzas'><![CDATA[
C: <iq from='[email protected]/core' type='get' id='roster-1'>
<query xmlns='jabber:iq:roster'/>
</iq>
S: <iq to='[email protected]/core' type='result' id='roster-1'>
<query xmlns='jabber:iq:roster'>
<item jid='[email protected]'/>
</query>
</iq>
C: <presence from='[email protected]/core'/>
]]></example>
<p>Now the client binds a second resource to the stream.</p>
<example caption='Binding a Second Resource'><![CDATA[
C: <iq from='[email protected]/balcony' type='set' id='bind-2'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>balcony</resource>
</bind>
</iq>
S: <iq to='[email protected]/balcony' type='result' id='bind-2'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>[email protected]/balcony</jid>
</bind>
</iq>
]]></example>
<p>If the server does not allow entities to bind multiple resources to the stream, it MUST return a ¬allowed; error as described in <cite>RFC 3920</cite>.</p>
<p>Now the client sends more stanzas.</p>
<example caption='Sending More Stanzas'><![CDATA[
C: <iq from='[email protected]/balcony' type='get' id='roster-2'>
<query xmlns='jabber:iq:roster'/>
</iq>
C: <iq to='[email protected]/balcony' type='result' id='roster-2'>
<query xmlns='jabber:iq:roster'>
<item jid='[email protected]'/>
</query>
</iq>
C: <presence from='[email protected]/balcony'/>
C: <message to='[email protected]'>
<body>Wherefore art thou?</body>
</message>
S: <message type='error'>
<body>Wherefore art thou?</body>
<error type='modify'>
<unknown-sender xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>
]]></example>
<p>In handling the last stanza shown above, the server returns an <unknown-sender/> error to the sender because the sender did not include a 'from' address.</p>
<p>Now the client binds a third resource to the stream.</p>
<example caption='Binding a Third Resource'><![CDATA[
C: <iq from='[email protected]/softphone' type='set' id='bind-3'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>softphone</resource>
</bind>
</iq>
S: <iq to='[email protected]/softphone' type='result' id='bind-3'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>[email protected]/softphone</jid>
</bind>
</iq>
]]></example>
<p>Now the client unbinds its initial resource.</p>
<example caption='Unbinding a Resource'><![CDATA[
C: <iq from='[email protected]/core' type='set' id='unbind-1'>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>core</resource>
</unbind>
</iq>
S: <iq from='[email protected]/core' type='result' id='unbind-1'/>
]]></example>
<p>Now the client unbinds another resource.</p>
<example caption='Unbinding a Resource'><![CDATA[
C: <iq from='[email protected]/softphone' type='set' id='unbind-2'>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>softphone</resource>
</unbind>
</iq>
S: <iq to='[email protected]/softphone' type='result' id='unbind-2'/>
]]></example>
<p>Now the client unbinds its last remaining resource.</p>
<example caption='Unbinding the Final Resource'><![CDATA[
C: <iq from='[email protected]/balcony' type='set' id='unbind-3'>
<unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<resource>balcony</resource>
</unbind>
</iq>
S: <iq to='[email protected]/balcony' type='result' id='unbind-3'/>
]]></example>
<p>The server now SHOULD close the stream and terminate the underlying TCP connection.</p>
<example caption='Server Closes the Stream'><![CDATA[
S: </stream:stream>
]]></example>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<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>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>No interaction with &IANA; is required as a result of this document.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<p>No interaction with the ®ISTRAR; is required as a result of this document, since the 'urn:ietf:params:xml:ns:xmpp-bind' namespace is already registered (see &NAMESPACES;).</p>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<p>Note: The following provisional schema is intended to replace the existing schema for the Resource Binding stream feature.</p>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:ietf:params:xml:ns:xmpp-bind'
xmlns='urn:ietf:params:xml:ns:xmpp-bind'
elementFormDefault='qualified'>
<xs:element name='bind'>
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs='0' maxOccurs='1'>
<xs:element name='resource' type='resourceType'/>
<xs:element name='jid' type='fullJIDType'/>
</xs:choice>
<xs:element name='required'
minOccurs='0'
maxOccurs='1'
type='empty'/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='unbind'>
<xs:complexType>
<xs:sequence minOccurs='0'>
<xs:element name='resource' type='resourceType'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name='resourceType'>
<xs:restriction base='xs:string'>
<xs:minLength value='1'/>
<xs:maxLength value='1023'/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name='fullJIDType'>
<xs:restriction base='xs:string'>
<xs:minLength value='8'/>
<xs:maxLength value='3071'/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
]]></code>
</section1>
</xep>