# HG changeset patch # User Goffi # Date 1426964866 -3600 # Node ID bbb900a768eae3075f9ee9b76a6728ec7e2ab9ee # Parent 21d0d0ab7aa013b936c6cf67e85790fd1ebf0750 xeps: updated xep-0355 (namespace delegation): Several updates according to feedbacks: - Added attribute filtering, mainly to manage correctly MAM - Simplification of configuration in admin mode: no more negociation - Delegations notifications to the managing entity are now done with a stanza - Forwarding now use XEP-0297 to avoid server to parse every stanza and a to have a cleaner separation - The behaviour when managing entity is unavailable is specified - Use of namespace in field var for client mode negociation is now mandatory - Behaviour when managing a delegation kept between session in client mode, when managing entity is not available, is specified - Implementation note added for in-order processing issue (thanks to Kurt Zeilenga for pointing this) - Added an note for discovery nesting with attribute filtering - Updated namespace to reflect incompatible changes diff -r 21d0d0ab7aa0 -r bbb900a768ea xmpp/xep-0355.xml --- a/xmpp/xep-0355.xml Fri Mar 20 16:13:10 2015 +0100 +++ b/xmpp/xep-0355.xml Sat Mar 21 20:07:46 2015 +0100 @@ -28,22 +28,45 @@ goffi@goffi.org goffi@jabber.fr + + + 0.2 + 2014-03-21 + jp +

Several updates according to feedbacks:

+
    +
  • Added attribute filtering, mainly to manage correctly MAM
  • +
  • Simplification of configuration in admin mode: no more &IQ; negociation
  • +
  • Delegations notifications to the managing entity are now done with a &MESSAGE; stanza
  • +
  • Forwarding now use &xep0297; to avoid server to parse every stanza and a to have a cleaner separation
  • +
  • The behaviour when managing entity is unavailable is specified
  • +
  • Use of namespace in field var for client mode negociation is now mandatory
  • +
  • Behaviour when managing a delegation kept between session in client mode, when managing entity is not available, is specified
  • +
  • Implementation note added for in-order processing issue (thanks to Kurt Zeilenga for pointing this)
  • +
  • Added an note for discovery nesting with attribute filtering
  • +
  • Updated namespace to reflect incompatible changes
  • +
+
+
+ 0.1 2014-12-18 XEP Editor (mam)

Initial published version approved by the XMPP Council.

+ 0.0.1 2014-11-13 jp

First draft.

+

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.
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.

+

This XEP is complementary to &xep0356; (and works in a similar way), although they can be used together or separately.

Here are some use cases of namespace delegation:

  • use an external component for a PEP service because the server doesn't implement it or lacks some features
  • @@ -64,50 +87,36 @@
    • Delegated namespace — the namespace being managed by an external entity.
    • +
    • Filtering attribute — an attribute which must be present in first &IQ; child element to delegate the namespace.
    • Managing entity — the entity which actualy manages the delegated namespace.
    • Managed entity — an entity which wants to have a namespace of its server delegated to a managing entity.
    + +

    Namespaces delegations are granted in the server configuration. Only &IQ; stanza namespaces can be delegated.

    +

    A feature is delegated using:

    +
      +
    1. it's namespace: e.g. 'urn:xmpp:mam:0'
    2. +
    3. zero or more filtering attribute (attributes which must be present in the initial &IQ; child element): e.g. 'node'
    4. +
    5. the jid of the managing entity: e.g. 'managing.capulet.lit'
    6. +
    +
    + - -

    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.

    - - - - - - - ]]> -
    - -

    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:

    - - - - - - -]]> -

    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:

    - - - - - - ]]> -
    +

    Once the managing entity is authenticated and stream is started, the server send it a &MESSAGE; stanza with a <delegation/> elements which MUST have the 'urn:xmpp:delegation:1' namespace. This element contains <delegated/> elements which MUST contain a 'namespace' attribute indicating the delegated namespace. If there is additional attribute filtering, the <delegated/> can have children <attribute/> elements which MUST contain a 'name' attribute with the name of the filtering attribute.

    + + + + + + + + + ]]> +

    Here pubsub.capulet.lit will received all stanzas of pubsub namespace sent to capulet.lit. It will also receive MAM stanzas, but only if the 'node' attribute is present in &QUERY;.

    @@ -128,41 +137,57 @@ ]]> -

    The server gets this stanza, sees that this namespace is delegated to pubsub.capulet.lit, so it forwards it:

    +

    The server gets this stanza, sees that this namespace is delegated to pubsub.capulet.lit, so it forwards it.

    +

    To forward, an &IQ; stanza of type "set" is used which contain a <delegation/> element (with namespace'urn:xmpp:delegation:1') which in turn contain a <forwarded/> element encapsulating the initial stanza, according to &xep0297;:

    - - - - - - curse my nurse! - - - - + + + + + + + + + curse my nurse! + + + + + + + + +]]> +

    The managing entity replies to the stanza by encapsulating its &IQ; result in the same way:

    + + + + + + + + ]]> -

    The managing entity replies normally to the stanza:

    - - - -]]> +

    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.

    +

    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 <service-unavailable/> to managed entity, and MAY close the connexion with managing entity.

    -

    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.

    - - @@ -170,6 +195,8 @@ ]]>

    The workflow is fully transparent for Juliet.

    +

    N.B.₁: 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 <service-unavailable/>

    +

    N.B.₂: 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

    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.

    @@ -187,32 +214,48 @@ ]]> - - - - + + + + + + + + + + + ]]> -

    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).

    +

    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).

    + 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:

    +

    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:

    ]]> -

    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:

    +

    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:

    - ]]> -

    The server will then send the roster pushes (with the enforced group) normally.

    +

    The server will then send the roster pushes (with the enforced group) normally.

    -
    +
    @@ -246,27 +289,24 @@ -

    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:

    -
      -
    1. the delegation type is client instead of admin
    2. -
    3. the delegation is done per entity, so the managed entity MUST be specified in a 'to' attribute
    4. -
    +

    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).

    +

    To request delegation for a particular entity, the managing entity MUST have an &IQ; stanza with 'urn:xmpp:delegation:1' namespace. The &QUERY; element MUST have a 'to' attribute which specify the entity it wants to manage.

    +

    Namespace delegations are asked with a <delegate/> element, which MUST contain a 'namespace' attribute set to the requested namespace.

    +

    If an entity want to manage PEP service for Juliet, it can ask the delegation like this:

    - ]]> -

    Once received the delegation request, the server ask to the client if it grant access to the requested namespace using &xep0004;. The server use a challenge which it MUST have generated itself. +

    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.

    + pubsub.montaigu.lit wants to manage a feature normally managed by the server. Do you allow it to manage the following features? @@ -280,7 +320,7 @@ Do you allow it? 5439123 - urn:xmpp:delegation:0 + urn:xmpp:delegation:1 ]]> -

    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 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 MUST use namespaces as field var, so a client can use them to have a customized display.

    The client can then answer to the form:

    + @@ -306,29 +346,29 @@ ]]>

    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:

    - - - - - - ]]> + + +

    Finaly, the server notifies the entity of the granted delegation. It do this in the same way as for admin mode, except that the <delegation/> element has an attitional 'to' attribute set to the managed entity bare jid:

    + + + + + +]]>

    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 &xep0050; on the well-defined command node 'urn:xmpp:delegation:0#configure'.

    +

    Server SHOULD provide a way for clients to check already delegated namespaces, and revoke them by using &xep0050; on the well-defined command node 'urn:xmpp:delegation:1#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 &xep0030; information request:

    +

    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:1" in response to a &xep0030; information request:

    ... - + ... @@ -353,7 +393,7 @@

    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).

    +

    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:1::http://jabber.org/protocol/pubsub' node which reports the managed features.

    The node name is obtained by concatenating this XEP namespace (urn:xmpp:delegation:1), 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.

    + node='urn:xmpp:delegation:1::http://jabber.org/protocol/pubsub'/> ]]> @@ -383,7 +423,7 @@ to='capulet.lit' type='result'> + node='urn:xmpp:delegation:1::http://jabber.org/protocol/pubsub'> @@ -399,8 +439,8 @@ to='juliet@capulet.lit/balcony' type='result'> - + node='urn:xmpp:delegation:1::http://jabber.org/protocol/pubsub'> + ... @@ -412,6 +452,7 @@ ]]>

    Note that 'http://jabber.org/protocol/pubsub#auto-create' is not available.

    +

    N.B.: 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.

    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.

    @@ -433,7 +474,7 @@ to='pubsub.capulet.lit' type='get'> + node='urn:xmpp:delegation:1:bare:http://jabber.org/protocol/pubsub'/> ]]> @@ -445,7 +486,7 @@ to='capulet.lit' type='result'> + node='urn:xmpp:delegation:1:bare:http://jabber.org/protocol/pubsub'> @@ -498,13 +539,16 @@
  • 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 suitable section. If server offers this feature, it SHOULD add a field directly in configuration commands.
  • 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.
  • If delegations are changed during a session, server MUST notify managing entity of the new delegations, like in client delegation request use case.
  • -
  • The namespace of this XEP (urn:xmpp:delegation:0) MUST NOT be delegated. If an entity requests it, the server MUST return a &forbidden; error.
  • +
  • If delegations are kept between sessions in client mode, and the managing entity is not available, the server MUST return an &IQ; error with condition <service-unavailable/> when a delegated namespace is requested, like explained in "Server Forwards Delegated &IQ; Stanza" section.
  • +
  • The namespace of this XEP (urn:xmpp:delegation:1) MUST NOT be delegated. If an entity requests it, the server MUST return a &forbidden; error.
    1. 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.
    2. Because of the performance impact, a server SHOULD ask for disco features to nest to managing entity when delegation is accepted, and keep them in cache.
    3. +
    4. &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). +
    @@ -520,9 +564,9 @@ -

    The ®ISTRAR; includes 'urn:xmpp:delegation:0' in its registry of protocol namespaces (see &NAMESPACES;).

    +

    The ®ISTRAR; includes 'urn:xmpp:delegation:1' in its registry of protocol namespaces (see &NAMESPACES;).

      -
    • urn:xmpp:delegation:0
    • +
    • urn:xmpp:delegation:1
    @@ -535,27 +579,18 @@ + + - - - - - + - - - - - - - - - @@ -564,6 +599,26 @@ + + + + + + + + + + + + + + + + ]]>
    @@ -571,5 +626,6 @@

    This XEP is linked with &xep0356; and works in a similar way.

    The client mode delegation mechanism is inspired from &xep0321; permission request.

    Thanks to Adrien Cossa for his typos/style corrections

    +

    Thanks to Philipp Hancke, Dave Cridland, Kurt Zeilenga and Sergey Dobrov for their feedbacks.