Abstract: | This specification provides a way for XMPP server to delegate treatments for a namespace to an other entity |
Author: | Jérôme Poisson |
Copyright: | © 1999 - 2014 XMPP Standards Foundation. SEE LEGAL NOTICES. |
Status: | Experimental |
Type: | Standards Track |
Version: | 0.1 |
Last Updated: | 2014-12-18 |
WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems are advised to carefully consider whether it is appropriate to deploy implementations of this protocol before it advances to a status of Draft.
1. Introduction
2. Requirements
3. Glossary
4. Admin Mode Use Cases
4.1. Delegation Request Use Case
4.1.1. Entity Requests Namespace Delegation
4.1.2. Server Accepts Namespace Delegation
4.1.3. Server Rejects Namespace Delegation
4.2. Server Forwards Delegated <iq/> Stanza
4.2.1. Stanzas from managing entity
5. Client Mode Use Cases
5.1. Client Delegation Request Use Case
6. Configuration
7. Discovering Support
7.1. Announce
7.2. Nesting
7.2.1. General Case
7.2.2. Rediction Of Bare JID Disco Info
8. Business Rules
9. Implementation Notes
10. Security Considerations
11. IANA Considerations
12. XMPP Registrar Considerations
12.1. Protocol Namespaces
12.2. Protocol Versioning
13. XML Schema
14. Acknowledgements
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
Some XMPP features must be offered by the server itself, or can't be available, that's the case of Personal Eventing Protocol (XEP-0163) [1] 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.
Additionaly, a method to do generic treatments (independent of server) on stanza is also provided.
This XEP is complementary to priviliged entity XEP (and works in a similar way), although they can be used together or separately.
Here are some use cases of namespace delegation:
Namespace delegation can be used in two modes:
In admin 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.
In client 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.
Once the managing entity is authenticated and stream is started, the entity can request to manage a namespace. It does it by sending an <iq/> stanza with 'urn:xmpp:delegation:0' namespace. The <query/> element MUST have a type of value "request" and MAY have a 'delegation' attribute with the value "admin".
Namespace delegations are asked with a <delegate/> element, which MUST contain a 'namespace' attribute set to the requested namespace.
Only <iq/> stanza namespaces can be delegated.
<iq from='pubsub.capulet.lit' type='get' id='delegation1'> <query xmlns='urn:xmpp:delegation:0' type='request' delegation='admin'> <delegate namespace='jabber:iq:roster'/> <delegate namespace='http://jabber.org/protocol/pubsub'/> </query> </iq>
If the server accepts the delegation (e.g.: namespace mapping specified in configuration), it MUST return an <iq/> result stanza, with allowed delegations in <delegate> elements:
<iq from='capulet.lit' to='pubsub.capulet.lit' type='result' id='delegation1'> <query xmlns='urn:xmpp:delegation:0' type='allowed'> <delegate namespace='jabber:iq:roster'> <delegate namespace='http://jabber.org/protocol/pubsub'> </query> </iq>
Note: the granted delegations MAY be different from the requested ones, according to server's configuration.
The server MUST then forward all requests made to itself on this namespace to the managing entity, except the requests made by the managing entity itself (see below).
The server MUST NOT forward any request made to an other entity than itself or to a bare JID within its domain.
If the server rejects the delegation, it MUST return a <forbidden/> error:
<iq from='capulet.lit' to='pubsub.capulet.lit' type='error' id='delegation1'> <error type='cancel'> <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
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 the bare JID of the sender (e.g. if 'from' attribute is "juliet@capulet.lit/balcony" and 'to' attribute is "juliet@capulet.lit"), it MUST forward it to the managing entity by replacing the 'to' attribute with the JID of the managing entity:
<iq from='juliet@capulet.lit/balcony' id='pep1' type='set'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <publish node='http://jabber.org/protocol/mood'> <item> <mood xmlns='http://jabber.org/protocol/mood'> <annoyed/> <text>curse my nurse!</text> </mood> </item> </publish> </pubsub> </iq>
The server gets this stanza, sees that this namespace is delegated to pubsub.capulet.lit, so it forwards it:
<iq from='juliet@capulet.lit/balcony' to='pubsub.capulet.lit' id='delegate1' type='set'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <publish node='http://jabber.org/protocol/mood'> <item> <mood xmlns='http://jabber.org/protocol/mood'> <annoyed/> <text>curse my nurse!</text> </mood> </item> </publish> </pubsub> </iq>
The managing entity replies normally to the stanza:
<iq from='pubsub.capulet.lit' to='juliet@capulet.lit/balcony' id='delegate1' type='result'> <pubsub xmlns='http://jabber.org/protocol/pubsub' /> </iq>
Then the server MUST change the from field of managing entity to its own JID, and send the answer back to Juliet with the original <iq/> id.
<iq from='capulet.lit' to='juliet@capulet.lit/balcony' id='pep1' type='result'> <pubsub xmlns='http://jabber.org/protocol/pubsub' /> </iq>
The workflow is fully transparent for Juliet.
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 special treatments.
In the following examples, juliet@capulet.lit has its "jabber:iq:roster" namespace delegated to filter.capulet.lit. filter.capulet.lit is a server agnostic component which filters allowed entities (which can be added to a roster), and sort them in enforced groups.
<iq from='juliet@capulet.lit/balcony' id='roster1' type='set'> <query xmlns='jabber:iq:roster'> <item jid='romeo@montaigu.lit' name='My Romeo'> </item> </query> </iq>
<iq from='juliet@capulet.lit/balcony' to='filter.capulet.lit' id='delegate1' type='set'> <query xmlns='jabber:iq:roster'> <item jid='romeo@montaigu.lit' name='My Romeo'> </item> </query> </iq>
filter.capulet.lit accepts to add Romeo, but all JIDs with a montaigu.lit must be in a "Rivals" group, so it first returns a success result (Romeo is accepted).
<iq from='filter.capulet.lit' to='juliet@capulet.lit/balcony' id='delegate1' type='result' />
<iq to='juliet@capulet.lit/balcony' id='roster1' type='result' />
At this stade, the entity is accepted, but not added to the roster. filter.capulet.lit is also a privileged entity which can manage "jabber:iq:roster", so it uses this ability to add Romeo in the enforced group:
<iq to='juliet@capulet.lit' from='filter.capulet.lit' id='roster2' type='set'> <query xmlns='jabber:iq:roster'> <item jid='romeo@montaigu.lit' name='My Romeo'> <group>Rivals</group> </item> </query> </iq>
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:
<iq to='filter.capulet.lit' from='juliet@capulet.lit' id='roster2' type='result'/>
The server will then send the roster pushes (with the enforced group) normally.
In client mode, the managing entity is not certified by the server administrator, so the delegation MUST be explicitly 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). It's done in the same way as for admin mode with the following exceptions:
If an entity want to manage PEP service for Juliet, it can ask the delegation like this:
<iq from='pubsub.montaigu.lit' to='capulet.lit' type='get' id='delegation1'> <query xmlns='urn:xmpp:delegation:0' type='request' delegation='client' to='juliet@capulet.lit'> <delegate namespace='http://jabber.org/protocol/pubsub'/> </query> </iq>
Once received the delegation request, the server ask to the client if it grant access to the requested namespace using Data Forms (XEP-0004) [2]. The server use a challenge which it MUST have generated itself.
<message from='capulet.lit' to='juliet@capulet.lit'> <body> pubsub.montaigu.lit wants to manage a feature normally managed by the server. Do you allow it to manage the following features? Be careful! According management to an entity is a serious thing, think twice that you can trust the entity before doing this. </body> <x xmlns='jabber:x:data' type='form'> <title>Delegation request</title> <instructions>pubsub.montaigu.lit wants to manage the following features: Do you allow it?</instructions> <field type='hidden' var='challenge'><value>5439123</value></field> <field type='hidden' var='FORM_TYPE'> <value>urn:xmpp:delegation:0</value> </field> <field type='list-single' label='Manage PubSub (http://jabber.org/protocol/pubsub)' var='http://jabber.org/protocol/pubsub'> <value>0</value> <option label='No'><value>0</value></option> <option label='Yes'><value>1</value></option> </field> </x> </message>
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 '0' (permission refused). The server SHOULD use namespace as field var, so a client can use it to have a customized display.
The client can then answer to the form:
<message from='juliet@capulet.lit' to='capulet.lit'> <x xmlns='jabber:x:data' type='submit'> <field var='FORM_TYPE'> <value></value> </field> <field var='challenge'><value>5439123</value></field> <field var='http://jabber.org/protocol/pubsub'><value>1</value></field> </x> </message>
Here Juliet allows pubsub.montaigu.lit to manage the PubSub (and then PEP) service.
Finaly, the server notifies the entity of the granted delegation. For this it uses a <query/> element with the 'allowed' type, and puts the client JID in a 'from' attribute:
<iq from='capulet.lit' to='pubsub.montaigu.lit' type='set' id='delegation2'> <query xmlns='urn:xmpp:delegation:0' type='allowed' from='juliet@capulet.lit'> <delegate namespace='http://jabber.org/protocol/pubsub'/> </query> </iq>
The managing entity can now manage the namespace the same way as in admin mode.
Server SHOULD provide a way for clients to check already delegated namespaces, and revoke them by using Ad-Hoc Commands (XEP-0050) [3] on the well-defined command node 'urn:xmpp:delegation:0#configure'.
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 business rules).
If a server or an entity supports the namespace delegation protocol, it MUST report that fact by including a service discovery feature of "urn:xmpp:delegation:0" in response to a Service Discovery (XEP-0030) [4] information request:
<iq from='pubsub.capulet.lit' id='disco1' to='capulet.lit' type='get'> <query xmlns='http://jabber.org/protocol/disco#info'/> </iq>
<iq from='capulet.lit' id='disco1' to='pubsub.capulet.lit' type='result'> <query xmlns='http://jabber.org/protocol/disco#info'> ... <feature var='urn:xmpp:delegation:0'/> ... </query> </iq>
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.
This is done by using a disco node, which is done the following way: if pubsub.capulet.int manages pubsub namespace, it MUST report that fact in discovery feature, and have a 'urn:xmpp:delegation:0::http://jabber.org/protocol/pubsub' node which reports the managed features.
The node name is obtained by concatenating this XEP namespace (urn:xmpp:delegation:0), a '::' separator, and the delegated namespace (here http://jabber.org/protocol/pubsub).
The server MUST advertise the result in its own discovery answer, and MUST ignore features of its internal component (here internal PubSub service).
In the following example, the capulet.int server delegates its internal PEP component to pubsub.capulet.int. capulet.int only supports REQUIRED PubSub features and auto-create, while pubsub.capulet.int supports REQUIRED PubSub features and publish-options, but not auto-create.
juliet@capulet.int asks its server what it is capable of, she is specially interested in PubSub capabilities.
<iq from='juliet@capulet.lit/balcony' id='disco1' to='capulet.lit' type='get'> <query xmlns='http://jabber.org/protocol/disco#info'/> </iq>
Server delegates its PubSub namespace to pubsub.capulet.lit, so it asks its available features for this namespace like this:
<iq from='capulet.lit' id='disco2' to='pubsub.capulet.lit' type='get'> <query xmlns='http://jabber.org/protocol/disco#info' node='urn:xmpp:delegation:0::http://jabber.org/protocol/pubsub'/> </iq>
Note that in real situation, server has probably this information already in cache (see Implementation Notes).
pubsub.capulet.lit returns its available features:
<iq from='pubsub.capulet.lit' id='disco2' to='capulet.lit' type='result'> <query xmlns='http://jabber.org/protocol/disco#info' node='urn:xmpp:delegation:0::http://jabber.org/protocol/pubsub'> <feature var='http://jabber.org/protocol/pubsub'/> <feature var='http://jabber.org/protocol/pubsub#publish'/> <feature var='http://jabber.org/protocol/pubsub#subscribe'/> <feature var='http://jabber.org/protocol/pubsub#publish-options'/> </query> </iq>
Server include the results in its own discovery info results:
<iq from='capulet.lit' id='disco1' to='juliet@capulet.lit/balcony' type='result'> <query xmlns='http://jabber.org/protocol/disco#info' node='urn:xmpp:delegation:0::http://jabber.org/protocol/pubsub'> <feature var='urn:xmpp:delegation:0'/> ... <feature var='http://jabber.org/protocol/pubsub'/> <feature var='http://jabber.org/protocol/pubsub#publish'/> <feature var='http://jabber.org/protocol/pubsub#subscribe'/> <feature var='http://jabber.org/protocol/pubsub#publish-options'/> ... </query> </iq>
Note that 'http://jabber.org/protocol/pubsub#auto-create' is not available.
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.
To do so, the mechanism is the same as for server features, but the separator is ':bare:' instead of '::':
<iq from='juliet@capulet.lit/balcony' id='disco3' to='juliet@capulet.lit' type='get'> <query xmlns='http://jabber.org/protocol/disco#info'/> </iq>
Server delegate its PubSub namespace to pubsub.capulet.lit, so it ask its available features for this namespace like this:
<iq from='capulet.lit' id='disco4' to='pubsub.capulet.lit' type='get'> <query xmlns='http://jabber.org/protocol/disco#info' node='urn:xmpp:delegation:0:bare:http://jabber.org/protocol/pubsub'/> </iq>
As for general case, server has probably this information already in cache.
pubsub.capulet.lit returns its available features:
<iq from='pubsub.capulet.lit' id='disco4' to='capulet.lit' type='result'> <query xmlns='http://jabber.org/protocol/disco#info' node='urn:xmpp:delegation:0:bare:http://jabber.org/protocol/pubsub'> <identity category='pubsub' type='pep'/> <feature var='http://jabber.org/protocol/pubsub#access-presence'/> <feature var='http://jabber.org/protocol/pubsub#auto-create'/> <feature var='http://jabber.org/protocol/pubsub#auto-subscribe'/> <feature var='http://jabber.org/protocol/pubsub#config-node'/> <feature var='http://jabber.org/protocol/pubsub#create-and-configure'/> <feature var='http://jabber.org/protocol/pubsub#create-nodes'/> <feature var='http://jabber.org/protocol/pubsub#filtered-notifications'/> <feature var='http://jabber.org/protocol/pubsub#persistent-items'/> <feature var='http://jabber.org/protocol/pubsub#publish'/> <feature var='http://jabber.org/protocol/pubsub#retrieve-items'/> <feature var='http://jabber.org/protocol/pubsub#subscribe'/> ... </query> </iq>
Then the server returns the answer to Juliet, as in general case, with requested bare JID in 'from' field.
<iq from='juliet@capulet.lit' id='disco3' to='juliet@capulet.lit/balcony' type='result'> <query xmlns='http://jabber.org/protocol/disco#info'> <identity category='account' type='registered'/> <identity category='pubsub' type='pep'/> <feature var='http://jabber.org/protocol/pubsub#access-presence'/> <feature var='http://jabber.org/protocol/pubsub#auto-create'/> <feature var='http://jabber.org/protocol/pubsub#auto-subscribe'/> <feature var='http://jabber.org/protocol/pubsub#config-node'/> <feature var='http://jabber.org/protocol/pubsub#create-and-configure'/> <feature var='http://jabber.org/protocol/pubsub#create-nodes'/> <feature var='http://jabber.org/protocol/pubsub#filtered-notifications'/> <feature var='http://jabber.org/protocol/pubsub#persistent-items'/> <feature var='http://jabber.org/protocol/pubsub#publish'/> <feature var='http://jabber.org/protocol/pubsub#retrieve-items'/> <feature var='http://jabber.org/protocol/pubsub#subscribe'/> ... </query> </iq>
This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [6].
The XMPP Registrar [7] includes 'urn:xmpp:delegation:0' in its registry of protocol namespaces (see <http://xmpp.org/registrar/namespaces.html>).
If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of XEP-0053.
<?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='urn:xmpp:delegation:0' xmlns='urn:xmpp:delegation:0' elementFormDefault='qualified'> <xs:element name='query'> <xs:complexType> <xs:attribute name='type' use='required'> <xs:simpleType base='xs:NMTOKEN'> <xs:enumeration value='request'/> <xs:enumeration value='allowed'/> </xs:simpleType> </xs:attribute> <xs:attribute name='delegation' use='optional'> <xs:simpleType base='xs:NMTOKEN'> <xs:enumeration value='admin'/> <xs:enumeration value='client'/> </xs:simpleType> </xs:attribute> <xs:attribute name='to' use='optional' type='xs:string'/> </xs:attribute> <xs:element name='delegation' maxOccurs='unbounded'> <xs:complexType> <xs:attribute name='namespace' use='required' type='xs:string'/> </xs:complexType> </xs:element> </xs:complexType> </xs:element> </xs:schema>
This XEP is linked with Privileged Entity (XEP-0356) [8] and works in a similar way.
The client mode delegation mechanism is inspired from Remote Roster Management (XEP-0321) [9] permission request.
Thanks to Adrien Cossa for his typos/style corrections
Series: XEP
Number: 0355
Publisher: XMPP Standards Foundation
Status:
Experimental
Type:
Standards Track
Version: 0.1
Last Updated: 2014-12-18
Approving Body: XMPP Council
Dependencies: XMPP Core, XEP-0004, XEP-0297
Supersedes: None
Superseded By: None
Short Name: NOT_YET_ASSIGNED
Source Control:
HTML
This document in other formats:
XML
PDF
Email:
goffi@goffi.org
JabberID:
goffi@jabber.fr
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) 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-0163: Personal Eventing Protocol <http://xmpp.org/extensions/xep-0163.html>.
2. XEP-0004: Data Forms <http://xmpp.org/extensions/xep-0004.html>.
3. XEP-0050: Ad-Hoc Commands <http://xmpp.org/extensions/xep-0050.html>.
4. XEP-0030: Service Discovery <http://xmpp.org/extensions/xep-0030.html>.
5. XEP-0050: Ad-Hoc Commands <http://xmpp.org/extensions/xep-0050.html>.
6. 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/>.
7. 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/>.
8. XEP-0356: Privileged Entity <http://xmpp.org/extensions/xep-0356.html>.
9. XEP-0321: Remote Roster Management <http://xmpp.org/extensions/xep-0321.html>.
Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/
Initial published version approved by the XMPP Council.
(XEP Editor (mam))First draft.
(jp)END