Abstract: | This document proposes improvements to the definition of resource binding for inclusion in the specification that supersedes RFC 3920. |
Author: | Peter Saint-Andre |
Copyright: | © 1999 - 2011 XMPP Standards Foundation. SEE LEGAL NOTICES. |
Status: | Deprecated |
Type: | Standards Track |
Version: | 1.1 |
Last Updated: | 2011-05-11 |
WARNING: This document has been Deprecated by the XMPP Standards Foundation. Implementation of the protocol described herein is not recommended. Developers desiring similar functionality are advised to implement the protocol that supersedes this one (if any).
1. Introduction
2. Unbinding a Resource
3. Business Rules
3.1. From Addresses
3.2. Server Sessions
4. Examples
5. Security Considerations
6. IANA Considerations
7. XMPP Registrar Considerations
8. XML Schema
Appendices
A: Document Information
B: Author Information
C: Legal Notices
D: Relation to XMPP
E: Discussion Venue
F: Requirements Conformance
G: Notes
H: Revision History
RFC 3920 introduced the concept of binding a resource to an XML stream (this concept superseded part of the obsolete jabber:iq:auth protocol described in Non-SASL Authentication [1]). As defined in RFC 3920, 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.
Note: The recommendations from this document were NOT incorporated into RFC 6120 [2].
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:
<iq from='someid@domain.tld/someresource' type='set' id='bind_2'> <unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'> <resource>someresource</resource> </unbind> </iq>
If the server does not understand the <unbind/> element, it MUST return an error of <bad-request/>. Otherwise, if there is no such resource, the server MUST return an error of <item-not-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 <localpart@domain.tld/resource> associated with the resource in question; however, the server MUST NOT accept further stanzas from that full JID after successfully processing the unbind request.
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:
<stream:features> <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'> <required/> </bind> <unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/> </stream:features>
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 <localpart@domain.tld/resource> 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. [3]
Naturally, the existing rules from RFC 3920 regarding validation of asserted 'from' addresses still apply.
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:
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).
First, the client binds an initial resource to the stream.
C: <iq from='juliet@capulet.com/core' type='set' id='bind-1'> <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'> <resource>core</resource> </bind> </iq> S: <iq to='juliet@capulet.com/core' type='result' id='bind-1'> <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'> <jid>juliet@capulet.com/core</jid> </bind> </iq>
Now the client sends some stanzas, making sure to set its 'from' address:
C: <iq from='juliet@capulet.com/core' type='get' id='roster-1'> <query xmlns='jabber:iq:roster'/> </iq> S: <iq to='juliet@capulet.com/core' type='result' id='roster-1'> <query xmlns='jabber:iq:roster'> <item jid='romeo@montague.net'/> </query> </iq> C: <presence from='juliet@capulet.com/core'/>
Now the client binds a second resource to the stream.
C: <iq from='juliet@capulet.com/balcony' type='set' id='bind-2'> <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'> <resource>balcony</resource> </bind> </iq> S: <iq to='juliet@capulet.com/balcony' type='result' id='bind-2'> <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'> <jid>juliet@capulet.com/balcony</jid> </bind> </iq>
If the server does not allow entities to bind multiple resources to the stream, it MUST return a <not-allowed/> error as described in RFC 3920.
Now the client sends more stanzas.
C: <iq from='juliet@capulet.com/balcony' type='get' id='roster-2'> <query xmlns='jabber:iq:roster'/> </iq> C: <iq to='juliet@capulet.com/balcony' type='result' id='roster-2'> <query xmlns='jabber:iq:roster'> <item jid='romeo@montague.net'/> </query> </iq> C: <presence from='juliet@capulet.com/balcony'/> C: <message to='romeo@montague.net'> <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>
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.
Now the client binds a third resource to the stream.
C: <iq from='juliet@capulet.com/softphone' type='set' id='bind-3'> <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'> <resource>softphone</resource> </bind> </iq> S: <iq to='juliet@capulet.com/softphone' type='result' id='bind-3'> <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'> <jid>juliet@capulet.com/softphone</jid> </bind> </iq>
Now the client unbinds its initial resource.
C: <iq from='juliet@capulet.com/core' type='set' id='unbind-1'> <unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'> <resource>core</resource> </unbind> </iq> S: <iq from='juliet@capulet.com/core' type='result' id='unbind-1'/>
Now the client unbinds another resource.
C: <iq from='juliet@capulet.com/softphone' type='set' id='unbind-2'> <unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'> <resource>softphone</resource> </unbind> </iq> S: <iq to='juliet@capulet.com/softphone' type='result' id='unbind-2'/>
Now the client unbinds its last remaining resource.
C: <iq from='juliet@capulet.com/balcony' type='set' id='unbind-3'> <unbind xmlns='urn:ietf:params:xml:ns:xmpp-bind'> <resource>balcony</resource> </unbind> </iq> S: <iq to='juliet@capulet.com/balcony' type='result' id='unbind-3'/>
The server now SHOULD close the stream and terminate the underlying TCP connection.
S: </stream:stream>
If properly implemented, the modifications described herein do not introduce any new security concerns above and beyond those defined in RFC 3920. 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).
No interaction with the Internet Assigned Numbers Authority (IANA) [5] is required as a result of this document.
No interaction with the XMPP Registrar [6] is required as a result of this document, since the 'urn:ietf:params:xml:ns:xmpp-bind' namespace is already registered (see <http://xmpp.org/registrar/namespaces.html>).
Note: The following provisional schema is intended to replace the existing schema for the Resource Binding stream feature.
<?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>
Series: XEP
Number: 0193
Publisher: XMPP Standards Foundation
Status:
Deprecated
Type:
Standards Track
Version: 1.1
Last Updated: 2011-05-11
Approving Body: XMPP Council
Dependencies: XMPP Core
Supersedes: None
Superseded By: None
Short Name: N/A
Source Control:
HTML
This document in other formats:
XML
PDF
Email:
stpeter@jabber.org
JabberID:
stpeter@jabber.org
URI:
https://stpeter.im/
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.
The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.
Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.
Errata can be sent to <editor@xmpp.org>.
The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".
1. XEP-0078: Non-SASL Authentication <http://xmpp.org/extensions/xep-0078.html>.
2. RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc6120>.
3. Currently there is no <unknown-sender/> stanza defined in RFC 3920. The author will work to add such an error condition (with a type of "modify") to the document that revises RFC 3920.
4. XEP-0016: Privacy Lists <http://xmpp.org/extensions/xep-0016.html>.
5. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.
6. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <http://xmpp.org/registrar/>.
Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/
Per a vote of the XMPP Council, changed specification to Deprecated because the recommendations described in this document were not incorporated into RFC 6120.
(psa)Per a vote of the XMPP Council, advanced specification to Draft.
(psa)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.
(psa)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.
(psa)Initial version.
(psa)Added stream feature for unbind.
(psa)First draft.
(psa)END