1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-21 16:55:07 -05:00
xeps/xep-0324.xml

2034 lines
353 KiB
XML
Raw Normal View History

2013-04-16 15:46:58 -04:00
<?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>
2013-05-06 23:07:23 -04:00
<title>Internet of Things - Provisioning</title>
<abstract>This specification describes an architecture for efficient provisioning of services, access rights and user privileges in for the Internet of Things, where
communication between Things is done using the XMPP protocol.</abstract>
&LEGALNOTICE;
2013-04-16 16:07:31 -04:00
<number>0324</number>
<status>Experimental</status>
2013-04-16 15:46:58 -04:00
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
<spec>XEP-0001</spec>
<spec>XEP-0030</spec>
2013-04-16 16:07:31 -04:00
<spec>XEP-0323</spec>
<spec>XEP-0325</spec>
2013-04-16 15:46:58 -04:00
</dependencies>
<supersedes/>
<supersededby/>
<shortname>sensor-network-provisioning</shortname>
2013-04-16 15:46:58 -04:00
<author>
<firstname>Peter</firstname>
<surname>Waher</surname>
<email>peter.waher@clayster.com</email>
<jid>peter.waher@jabber.org</jid>
<uri>http://www.linkedin.com/in/peterwaher</uri>
2013-04-16 15:46:58 -04:00
</author>
<revision>
<version>0.3</version>
<date>2014-05-21</date>
<initials>pw</initials>
<remark>
<p>Element renamed from <strong>Friend</strong> to <strong>friend</strong> when recommending friendships.</p>
<p><strong>clearCache</strong> IQ stanzas now of type <strong>set</strong> instead of <strong>get</strong>.</p>
<p>Corrected schema with regards to tokens.</p>
<p>The <strong>getToken</strong> command now takes a base-64 encoded X.509 certificate (public part) instead of arbitrary string IDs.</p>
<p>An additional challenge/response step has been added to make sure the sender of a certificate has access to the private part of the certificate.</p>
<p>Named links to all sections in the document.</p>
<p>Added reference to XEP-0347, for how things can find provisioning servers.</p>
<p>Added method of finding provisioning server, if server hosted as a server component.</p>
<p>Updated examples to reflect a provisioning server hosted as a server component, harmonizing with XEP-0347.</p>
<p>Added a section about token challenges and token propagation.</p>
<p>Added a security note regarding token challenges.</p>
<p>Updated id-attributes in examples.</p>
</remark>
</revision>
<revision>
<version>0.2</version>
<date>2014-03-10</date>
<initials>pw</initials>
<remark>
<p>Corrected downloadPrivileges example.</p>
<p>Made several corrections of the language.</p>
<p>Expanded the introduction.</p>
<p>Changes "Sensor Networks" to "Internet of Things".</p>
<p>Fixed links to documents with new numbers.</p>
<p>Changed namespace urn:xmpp:sn to urn:xmpp:iot</p>
</remark>
</revision>
<revision>
<version>0.1</version>
<date>2013-04-16</date>
<initials>psa</initials>
<remark>
<p>Initial published version approved by the XMPP Council.</p>
</remark>
</revision>
<revision>
2013-04-16 15:46:58 -04:00
<version>0.0.5</version>
<date>2013-04-04</date>
<initials>pw</initials>
2013-04-16 15:46:58 -04:00
<remark>
<p>Added control use cases.</p>
<p>Grouped use cases.</p>
</remark>
</revision>
<revision>
<version>0.0.4</version>
<date>2013-04-01</date>
<initials>pw</initials>
2013-04-16 15:46:58 -04:00
<remark>
<p>Added altitude credentials.</p>
<p>Added resource information of original called to their corresponding JIDs.</p>
<p>Changed the return type of a rejected message.</p>
<p>Made images inline.</p>
<p>Converted the glossary into a definition list.</p>
</remark>
</revision>
<revision>
<version>0.0.3</version>
<date>2013-03-18</date>
<initials>pw</initials>
2013-04-16 15:46:58 -04:00
<remark>
<p>Added information about how to read sensors from large subsystems.</p>
<p>Added friend recommendation message.</p>
<p>Added client/device/service tokens.</p>
</remark>
</revision>
<revision>
<version>0.0.2</version>
<date>2013-03-12</date>
<initials>pw</initials>
2013-04-16 15:46:58 -04:00
<remark>
<p>Added use cases for service access rights and corresponding user privileges.</p>
</remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2013-03-11</date>
<initials>pw</initials>
2013-04-16 15:46:58 -04:00
<remark>
<p>First draft.</p>
</remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>
This specification describes an architecture for efficient provisioning of services, access rights and user privileges in for the Internet of Things, where
communication between Things is done using the XMPP protocol.
</p>
<p>
Note has to be taken, that this XEP, and other Internet of Things-related XEP's, are designed for implementation in small devices, many of which have very limited
amount of memory (both RAM and ROM) or resources (processing power). Therefore, simplicity is of utmost importance. Furthermore, Internet of Things networks can
become huge, easily containing millions or billions of devices in peer-to-peer networks.
2013-04-16 15:46:58 -04:00
</p>
<p>
An added complexity in the provisioning case is that Things (small sensors for example) often have very limited user interface options. Therefore, this document
explains how provisioning can be done efficiently using a trusted third party with more power and options when it comes to user interface design and storage.
2013-04-16 15:46:58 -04:00
</p>
<p>
This document defines the following important operations to allow for efficient provisioning of services in the Internet of Things, based on XMPP:
</p>
<ul>
<li>What Things knows what Things</li>
<li>What Things can read data from what Things, and what data.</li>
<li>What Things can control what Things, and what parts.</li>
<li>Control of Users in the network.</li>
<li>Control of Services in the network.</li>
<li>Control generic boolean User Privileges in the network.</li>
</ul>
2013-04-16 15:46:58 -04:00
<p>
This XEP relies on &xep0323; and &xep0325; for sensor data readout and control interfaces. It relies on &xep0326; for bridging protocols and interfaing entities with multiple devices
behind them. It also ties into &xep0347; for automatic discovery of provisioning servers by things.
</p>
<p>
Internet of Things contain many different architectures and use cases. For this reason, the IoT standards have been divided into multiple XEPs according to the following table:
</p>
<table caption='Internet of Things XEPs'>
2013-04-16 15:46:58 -04:00
<tr>
<th>XEP</th>
<th>Description</th>
</tr>
<tr>
<td>xep-0000-IoT-BatteryPoweredSensors</td>
2013-04-16 15:46:58 -04:00
<td>Defines how to handle the peculiars related to battery powered devices, and other devices intermittently available on the network.</td>
</tr>
<tr>
<td>xep-0000-IoT-Events</td>
<td>Defines how Things send events, how event subscription, hysteresis levels, etc., are configured.</td>
2013-04-16 15:46:58 -04:00
</tr>
<tr>
<td>xep-0000-IoT-Interoperability</td>
<td>Defines guidelines for how to achieve interoperability in Internet of Things, publishing interoperability interfaces for different types of devices.</td>
2013-04-16 15:46:58 -04:00
</tr>
<tr>
<td>xep-0000-IoT-Multicast</td>
2013-04-16 15:46:58 -04:00
<td>Defines how sensor data can be multicast in efficient ways.</td>
</tr>
<tr>
<td>xep-0000-IoT-PubSub</td>
<td>Defines how efficient publication of sensor data can be made in Internet of Things.</td>
2013-04-16 15:46:58 -04:00
</tr>
<tr>
<td>xep-0000-IoT-Chat</td>
<td>Defines how human-to-machine interfaces should be constructed using chat messages to be user friendly, automatable and consistent with other IoT extensions and possible underlying architecture.</td>
</tr>
<tr>
<td>XEP-0322</td>
<td>
Defines how to EXI can be used in XMPP to achieve efficient compression of data. Albeit not an Internet of Things specific XEP, this XEP should be considered
in all Internet of Things implementations where memory and packet size is an issue.
</td>
</tr>
<tr>
<td>XEP-0323</td>
2013-04-16 15:46:58 -04:00
<td>
Provides the underlying architecture, basic operations and data structures for sensor data communication over XMPP networks.
It includes a hardware abstraction model, removing any technical detail implemented in underlying technologies. This XEP is used by all other
Internet of Things XEPs.
2013-04-16 15:46:58 -04:00
</td>
</tr>
<tr>
<td>XEP-0324</td>
<td>This specification. Defines how provisioning, the management of access privileges, etc., can be efficiently and easily implemented.</td>
</tr>
<tr>
<td>XEP-0325</td>
<td>Defines how to control actuators and other devices in Internet of Things.</td>
</tr>
<tr>
<td>XEP-0326</td>
<td>Defines how to handle architectures containing concentrators or servers handling multiple Things.</td>
</tr>
<tr>
<td>XEP-0331</td>
<td>Defines extensions for how color parameters can be handled, based on &xep0004;</td>
</tr>
<tr>
<td>XEP-0336</td>
<td>Defines extensions for how dynamic forms can be created, based on &xep0004;, &xep0122;, &xep0137; and &xep0141;.</td>
</tr>
<tr>
<td>XEP-0347</td>
<td>Defines the peculiars of sensor discovery in sensor networks. Apart from discovering sensors by JID, it also defines how to discover sensors based on location, etc.</td>
</tr>
</table>
2013-04-16 15:46:58 -04:00
</section1>
<section1 topic='Glossary' anchor='glossary'>
<p>The following table lists common terms and corresponding descriptions.</p>
<dl>
<di>
<dt>Actuator</dt>
<dd>Device containing at least one configurable property or output that can and should be controlled by some other entity or device.</dd>
</di>
<di>
<dt>Authority</dt>
<dd>Used synonymously with Provisioning Server.</dd>
</di>
<di>
2013-04-16 15:46:58 -04:00
<dt>Computed Value</dt>
<dd>A value that is computed instead of measured.</dd>
</di>
<di>
<dt>Concentrator</dt>
<dd>Device managing a set of devices which it publishes on the XMPP network.</dd>
</di>
<di>
<dt>Field</dt>
<dd>
One item of sensor data. Contains information about: Node, Field Name, Value, Precision, Unit, Value Type, Status, Timestamp, Localization information, etc.
Fields should be unique within the triple (Node ID, Field Name, Timestamp).
</dd>
</di>
<di>
<dt>Field Name</dt>
<dd>Name of a field of sensor data. Examples: Energy, Volume, Flow, Power, etc.</dd>
</di>
<di>
<dt>Field Type</dt>
<dd>What type of value the field represents. Examples: Momentary Value, Status Value, Identification Value, Calculated Value, Peak Value, Historical Value, etc.</dd>
</di>
<di>
<dt>Historical Value</dt>
<dd>A value stored in memory from a previous timestamp.</dd>
</di>
<di>
<dt>Identification Value</dt>
<dd>A value that can be used for identification. (Serial numbers, meter IDs, locations, names, etc.)</dd>
</di>
<di>
<dt>Localization information</dt>
<dd>Optional information for a field, allowing the sensor to control how the information should be presented to human viewers.</dd>
</di>
<di>
<dt>Meter</dt>
<dd>A device possible containing multiple sensors, used in metering applications. Examples: Electricity meter, Water Meter, Heat Meter, Cooling Meter, etc.</dd>
</di>
<di>
<dt>Momentary Value</dt>
<dd>A momentary value represents a value measured at the time of the read-out.</dd>
</di>
<di>
<dt>Node</dt>
<dd>
Graphs contain nodes and edges between nodes. In Internet of Things, sensors, actuators, meters, devices, gateways, etc., are often depicted as nodes whereas links between sensors (friendships)
are depicted as edges. In abstract terms, it's easier to talk about a Node, rather than list different possible node types (sensors, actuators, meters, devices, gateways, etc.).
Each Node has a Node ID.
</dd>
2013-04-16 15:46:58 -04:00
</di>
<di>
<dt>Node ID</dt>
<dd>
An ID uniquely identifying a node within its corresponding context. If a globally unique ID is desired, an architecture should be used using a universally accepted
2013-04-16 15:46:58 -04:00
ID scheme.
</dd>
</di>
<di>
<dt>Parameter</dt>
<dd>
Readable and/or writable property on a node/device. The XEP-0326 &xep0326; deals with reading and writing parameters
2013-04-16 15:46:58 -04:00
on nodes/devices. Fields are not parameters, and parameters are not fields.
</dd>
</di>
<di>
<dt>Peak Value</dt>
<dd>A maximum or minimum value during a given period.</dd>
</di>
<di>
<dt>Provisioning Server</dt>
<dd>An application that can configure a network and provide services to users or Things. In Internet of Things, a Provisioning Server knows who knows whom,
what privileges users have, who can read what data and who can control what devices and what parts of these devices.</dd>
</di>
<di>
2013-04-16 15:46:58 -04:00
<dt>Precision</dt>
<dd>
In physics, precision determines the number of digits of precision. In sensor networks however, this definition is not easily applicable. Instead, precision
determines, for example, the number of decimals of precision, or power of precision. Example: 123.200 MWh contains 3 decimals of precision. All entities parsing and
delivering field information in sensor networks should always retain the number of decimals in a message.
</dd>
</di>
<di>
<dt>Sensor</dt>
<dd>
Device measuring at least one digital value (0 or 1) or analog value (value with precision and physical unit). Examples: Temperature sensor, pressure sensor, etc.
Sensor values are reported as fields during read-out. Each sensor has a unique Node ID.
</dd>
</di>
<di>
<dt>SN</dt>
<dd>Sensor Network. A network consisting, but not limited to sensors, where transport and use of sensor data is of primary concern. A sensor network may contain actuators, network applications, monitors, services, etc.</dd>
</di>
<di>
<dt>Status Value</dt>
<dd>A value displaying status information about something.</dd>
</di>
<di>
<dt>Timestamp</dt>
<dd>Timestamp of value, when the value was sampled or recorded.</dd>
</di>
<di>
<dt>Thing</dt>
<dd>
Internet of Things basically consists of Things connected to the Internet. Things can be any device, sensor, actuator etc., that can have an
Internet connection.
</dd>
</di>
<di>
<dt>Thing Registry</dt>
<dd>
A registry where Things can register for simple and secure discovery by the owner of the Thing. The registry can also be used as a database for meta information
about Things in the network.
</dd>
</di>
<di>
2013-04-16 15:46:58 -04:00
<dt>Token</dt>
<dd>
A client, device or user can get a token from a provisioning server. These tokens can be included in requests to other entities in the network, so these entities can validate
2013-04-16 15:46:58 -04:00
access rights with the provisioning server.
</dd>
</di>
<di>
<dt>Unit</dt>
<dd>Physical unit of value. Example: MWh, l/s, etc.</dd>
</di>
<di>
<dt>Value</dt>
<dd>A field value.</dd>
</di>
<di>
<dt>Value Status</dt>
<dd>Status of field value. Contains important status information for Quality of Service purposes. Examples: Ok, Error, Warning, Time Shifted, Missing, Signed, etc.</dd>
</di>
<di>
<dt>Value Type</dt>
<dd>Can be numeric, string, boolean, Date &amp; Time, Time Span or Enumeration.</dd>
</di>
<di>
<dt>WSN</dt>
<dd>Wireless Sensor Network, a sensor network including wireless devices.</dd>
</di>
<di>
<dt>XMPP Client</dt>
<dd>Application connected to an XMPP network, having a JID. Note that sensors, as well as applications requesting sensor data can be XMPP clients.</dd>
</di>
</dl>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
<p>
The most basic use case in sensor networks is to read out sensor data from a sensor. However, since protecting end-user integrity and system security is vital, access
rights and user privileges have to be imposed on the network.
</p>
<p>
To store access rights in all sensors might be very impractical. Not only does it consume memory, it's difficult to maintain track of the current system status, make sure
all devices have the latest configuration, distribute changes to the configuration, etc.
</p>
<p>
Furthermore, most sensors and small devices have very limited possibility to provide a rich user interface. Perhaps all it can do is to provide a small LED and a button,
useful perhaps for installing the sensor in the network, but not much more.
</p>
<p>
As an added complexity, the sensor network operator might not even have access to the XMPP Servers used, and provisioning needs to lie outside of the XMPP Server domains.
</p>
<p>
To solve this problem in an efficient manner, an architecture using distributed trusted third parties is proposed. Such third parties would:
</p>
<ul>
<li>Provide a rich user interface and configurable options to end user or back end systems.</li>
<li>Control friendships (who can communicate with whom).</li>
<li>Control content available for different friends (what can be read by whom).</li>
<li>Control operations accessible by different friends (what can be controlled/configured by whom).</li>
<li>Provide additional interoperability services to nodes in the network (for instance, unit conversion).</li>
</ul>
<section2 topic='Delegating trust' anchor='delegatingtrust'>
<section3 topic='Delegating original trust to a Provisioning Server' anchor='delegatingoriginaltrust'>
<p>
A provisioning server can be accessed either through a JID published by the provisioning server, or through a subdomain address, if hosted as a server component.
This section will show how to delegate original trust to a Provisioning Server, in the case the server uses a JID to communicate with things.
</p>
<p>
Trust is delegated to a provisioning server by a device, simply by befriending the provisioning server and asking it questions and complying with
its answers. As an illustrative example, following is a short description of how such a trust relationship can be created in a scenario where the sensor only
has a single LED and a single button.
</p>
2013-04-16 15:46:58 -04:00
<ul>
<li>Somebody is installing the sensor, giving it a connection to an XMPP server and a JID, reachable from the provisioning server.</li>
<li>The provisioning server is told to create a friendship request to the new sensor.</li>
<li>The sensor flashes its LED for a given time (for example: 30 seconds).</li>
<li>Viewing the LED, the person installing the sensor presses the button.</li>
<li>Receiving the button press within the given time period, accepts the friendship request. Optionally, the device can give user feedback using the LED.</li>
<li>The device performs a service discovery of the new friend, having been a manually added friend.</li>
<li>If the new friend supports this provisioning extension, further responsibilities are delegated to this device.</li>
<li>As the last step the device asks the provisioning server for a token. This device token is later used in calls to other devices and can be used to check access rights.</li>
</ul>
<p>
The following diagram shows the general case:
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAY8AAANXCAIAAABCCkTbAAAgAElEQVR4nO3df48U953g8c8jiswMM4J+GLeOMcZ2mCT0E7jTRontZCz/wnYO9UmrO10Ur1dEFo5vZDvHqRUr5wMfimVOHGOzrHeOxmCHJYQQwgLHerlY6vujuj9VXVVd3dP9/V3vl0q7w/zoqf5+P/WemoYkMgSAGIjvEwCAuVArAHHIayUAEKSaWrlOJRxifxEpatU67C8iRa1ah/1FpKhV67C/iBS1ah32F5EyVqtBr9PtF/7c7xZfye/0BvVf1u82fHAX33fhxxn0Os1n2fDIu/qm5U8ufuPmNWo694k1nwOpQrwM1WrQ64hUajW+/qofrf20BTQ88lwmvv3S5Zz/W02+e7EnsPvnTqoQtTlqVbgJmLiwRWR0teSfkV88kxfn+JrUzxx/KP+0yof0PZ1utyOd3qByJoXv2x0/Tr87+lN+OpXHmXhmhetd/9zvinQ6HZFOb1A9Q32c/v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2hQK4LVctQqGtSKWrUctYoGtaJWLUet4iAi1wfnqJXtWhGskFGrOFArbq9AreJAragVqFUcqBW1ArWKA7VyViuCFSxqFQdqRa1AreJAragVqFUcqBW1ArWKA7WiVqBWcaBW1ArUKg7UilqBWsWBWlErUKs4UCtqBWoVB2pFrUCt4kCtqBWoVRyoFbUCtYoDtaJWoFZxoFbUCtQqDtSKWoFaxYFaUStQqzhQK2oFahUHakWtQK3iQK2oFahVHKiVs1RRq2BRq2jwv35KrVqOWkWDWlGrlqNW0aBWbmrle58xFb
</p>
2013-04-16 15:46:58 -04:00
<p>
The successful case can also be illustrated in a sequence diagram, as follows:
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwQAAAH4CAIAAAB7Vr3+AAAgAElEQVR4nO3daa80Z3ng8fpK2LFl1xdJjBMcA67PMFLCxDMB7CEDqrczw5LhBRBkKWQslZRZCAmjkYgITggQJ20W2wm7wXYImy2dedFdXWtvp7vvrrrq95Mln6eX6qrT9Vzn77vLz5PdAQAsWHbrHQAAuCUxBAAsWhNDGQDAkozEUOoS4/q8rQAwSgwthbcVAEaJoaXwtgLAKDG0FN5WABglhpbC2woAo86MoVWZZ3m5am6oiva12Z272qpiz51HvnBRnbGdVZnv38s9Wz7pRfsPbr/w/u/Rvn0vqtOeooQAYJdrxFB9w6rMs2z8x/aZMbRny0fpvPzZYXb8S3Vvvt8BnH7sSggA9jgmhprFjE7mZFmWF8WeGGp+5G+3UN/VPGxw13DjrcWUvFy196co6u1UxeZXWVanws6d7OfE9tdVkWV5nmdZXq6Ge7jdTrX7Rfu7ekQM9V+0dWv3YPvHflwPKSEA2O+IGBr8OG9iYlXm2b4YWi8cVdvlo+0P+/phq8Fdezbe65POx2RVkXU3vWc7o8tZ9dbqyGjvYW87u190ZFePiqH2i3ZjaPj0U1aGlBAAHHTaylBTBZsf0Hs/Jqt/uI9cR9T+Wd+9a2zjg/WW8RjqZMSendy7MlTfPsy17Ze7X3RkV4+KofaL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bUiCEIyMkPJBBm1ESOIQCAg8QQALBoYggAWDQxBAAsWuQYCnMgcConP5BAmFEjhiAgJz+QQJhRI4Y
</p>
<p>
<strong>Note:</strong> In many cases, an address to a provisioning server might be preprogrammed during production of the
device. In these cases, parts of the above procedure may not be necessary. All the client needs to do, if the provisioning server is not available
in the roster of the device, is to send a subscription request to the provisioning server, to alert the server of the existence of the device,
and possibly request a device token.
</p>
<p>
<strong>Note 2:</strong> A certificate token has an undefined lifetime. It can be reused across sessions.
</p>
<p>
The following use cases will assume such a trust relationship has been created between the corresponding device and the provisioning server.
</p>
</section3>
<section3 topic='Provisioning Server as a server component' anchor='servercomponent'>
<p>
A provisioning server can also be hosted as a server component, and in these cases be addressed by using the component address, or sub-domain address of the component.
In this case, the client searches through the components hosted by the server to see if one of them is a Provisioning Server. There are no friendship requests and
presence subscriptions necessary, when communicating with a Provisioning Server hosted as a server component.
</p>
<p>
To search for a Provisioning Server hosted as a component on an XMPP Server, you first request a list of available components, as follows:
</p>
<example caption="Checking if server supports components">
<![CDATA[
<iq from='device@clayster.com/device' to='clayster.com' type='get' id='1'>
<query xmlns="http://jabber.org/protocol/disco#info"/>
</iq>
<iq type="result" id="1" from="clayster.com" to="device@clayster.com/device">
<query xmlns="http://jabber.org/protocol/disco#info">
...
<feature var="http://jabber.org/protocol/disco#items"/>
...
</query>
</iq>]]>
</example>
<p>
If components (items) are supported, a request for available components is made:
</p>
<example caption="Requesting list of server components">
<![CDATA[
<iq from='device@clayster.com/device' to='clayster.com' type='get' id='2'>
<query xmlns="http://jabber.org/protocol/disco#items"/>
</iq>
<iq type="result" id="2" from="clayster.com" to="995fab3dd759452ca9c370647323af0c@clayster.com/ebe2348e">
<query xmlns="http://jabber.org/protocol/disco#items">
...
<item jid="provisioning.clayster.com" name="Provisioning"/>
...
</query>
</iq>]]>
</example>
<p>
The client then loops through all components (items) and checks what features they support, until a Provisioning Server is found:
</p>
<example caption="Service discovery information request made to each component">
<![CDATA[
2013-04-16 15:46:58 -04:00
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='3'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='device@clayster.com/device'
id='3'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='urn:xmpp:iot:provisioning'/>
...
</query>
2013-04-16 15:46:58 -04:00
</iq>]]>
</example>
</section3>
<section3 topic="Tokens and X.509 Certificates" anchor="tokenscertificats">
<p>
The provisioning server contains a set of rules defining what operation can take place and by whom, by participants in the network. Rules can be applied based on JIDs used,
content affected, and also through device, service and user identities based on X.509 Certificates. In order for a service (for instance) to identify itself in the network, it
uses an X.509 certificate. It sends the public part of this certificate to the provisioning server, and receives a token back in the form of a simple string. This token can then
be used in requests and propagated through the network.
</p>
<p>
To validate that the sender is allowed to use the certificate using its token, it encrypts a challenge using the public part of the certificate and sends it to the sender of the
token, who in turn decrypts it using the private part of the certificate and returns it to the server. The provisioning server can also use the public part of the certificate to
perform validation checks on the certificate itself. If the certificate becomes invalid, the provisioning server can invalidate any corresponding rules in the network. If the sender
of a token cannot respond to a token challenge, the provisioning server can also refuse to allow the operation.
</p>
<p>
In case of multiple units being part of an operation, a token can be propagated in the network. For example, a service can read data from U1, who reads data from U2. The service
provides a token to U1, who propagates this token in the request to U2. When U2 asks the provisioning server if the operation should be allowed or not, the server knows what entity
originated the request. If the provisioning server wants to challenge U2, concerning the token, U2 propagates the challenge to U1, who propagates it to the service, who can resolve
the challenge, returns the response back to U1 who returns the response to U2 who in turn returns it to the provisioning server.
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAvMAAALdCAIAAAAuwXvGAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAFuVSURBVHhe7d17kzxPVt/3eUrsshtLPxG0ICEtl34MjgBk2UiAQRD9r21hyf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SI41ktMIMmltayapbAobb/42EVFrRHQTkmON5DSCTFrbmkkqm8LGm79NRNQaEd2E5FgjOY0gk9a2ZpLKprDx5m8TEbVGRDchOdZITiPIpLWtmaSyKWy8+dtERK0R0U1IjjWS0wgyaW1rJqlsChtv/jYRUWtEdBOSY43kNIJMWtuaSSqbwsabv01E1BoR3YTkWCM5jSCT1rZmcnNlA7PphcY+9HsDh4g+Tl8yOCSnBfrNgLMpk9sqG2OPcUhLn2QLTV8UtCT7Hu3ciOh5ZS/dzo3kYCr7puzczphJKpsKTV8UtCT7Hu3ciOh5ZS/dzo3kYCr7puzcqGx2arz58aHse7RzI6Lnlb10OzeSg6nsm7Jze6HK5ljyQusW0CQiijIkB605YyapbID6iCjKkBy0hspmJ7z50TgiijIkB62hstkJb340joiiDMlBa6hsAAAAjkRlAwAA+kFlAwAA+kFlAwAA+nHKyoZfskPjiCjKkBy0ht8g3glvfjSOiKIMyUFrqGx2wpsfjSOiKENy0Boqm53w5kfjiCjKkBy0hspmJ7z50TgiijIkB62hstkJb340joiiDMlBa6hsdsKbH40joihDctAaKhsAAIAjUdkAAIB+UNkAAIB+UNkAAIB+nL
</p>
<section4 topic='Requesting a token' anchor='requesttoken'>
<p>
The following example shows how a device or service can request a token from the provisioning server, by providing the base-64 encoded public part of an X.509 certificate.
This step is optional, but can be used as a method to identify the device (or service), apart from the JID it is using. This might be useful if you want to assign a particular
device or service privileges in the provisioning server, regardless of the JID it uses to perform the action.
</p>
<example caption='Requesting a token'>
<![CDATA[
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='4'>
<getToken xmlns='urn:xmpp:iot:provisioning'>BASE-64 ENCODED PUBLIC X.509 CERTIFICATE</getToken>
</iq>
<iq type='result'
from='provisioning.clayster.com'
to='device@clayster.com/device'
id='4'>
<getTokenChallenge xmlns='urn:xmpp:iot:provisioning' seqnr='1'>BASE-64 ENCODED CHALLENGE</getTokenChallenge>
</iq>
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='5'>
<getTokenChallengeResponse xmlns='urn:xmpp:iot:provisioning' seqnr='1'>BASE-64 ENCODED RESPONSE</getTokenChallengeResponse>
</iq>
<iq type='result'
from='provisioning.clayster.com'
to='device@clayster.com/device'
id='5'>
<getTokenResponse xmlns='urn:xmpp:iot:provisioning' token='TOKEN'/>
</iq>]]>
</example>
<p>
The <strong>getToken</strong> element contains the base-64 encoded public version of the certificate that is used to identify the device or service. The server
responds with a challenge in a <strong>getTokenChallenge</strong> response. This challenge is also a base-64 encoded binary block of data, which corresponds to a random
sequence of bytes that is then encrypted using the public certificate. Now, the device, or service, decrypts this challenge using the private part of the certificate, and
returns the base-64 encoded decrypted version of the challenge back to the provisioning server using the <strong>getTokenChallengeResponse</strong> element. The provisioning
server checks the response to the original random sequence of bytes. If equal, the provisioning server responds with a <strong>getTokenResponse</strong> result, containing
the token (a string this time) that can be used when reference to the identity defined by the certificate has to be made. The provisioning server must not return tokens that
contain white space characters.
</p>
<p>
If the response to the challenge is wrong, the server returns a <strong>bad-request</strong> error result, as is shown below.
</p>
<example caption='Challenge reponse incorrect'>
<![CDATA[
<iq type='result'
from='provisioning.clayster.com'
to='device@clayster.com/device'
id='5'>
<error type='modify'>
<bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>]]>
</example>
<p>
If the sequence number identifying the challenge is not found on the server, the server returns a <strong>item-not-found</strong> error result, as is shown below.
</p>
<example caption='Challenge sequence number not found'>
<![CDATA[
<iq type='result'
from='provisioning.clayster.com'
to='device@clayster.com/device'
id='5'>
<error type='cancel'>
<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>]]>
</example>
<p>
The server must retain the challenge in memory for at least one minute before assuming the challenge will go unresponded.
</p>
</section4>
<section4 topic='Provisioning Server challenging a token' anchor='tokenchallenge'>
<p>
For reasons the provisioning server determines, it can challenge the use of a token in any of the requests made to it. This is done by sending a
iq get stanza with a <strong>tokenChallenge</strong> to the party sending the token. This element contains both the token being challenged, and a binary
challenge. This challenge is made up of a random block of data that is encrypted using the public certificate referred to by the token.
</p>
<p>
The receiver of the challenge, if it has access to the private certificate referenced, decrypts the challenge, and returns the decrypted binary block of data
to the caller (i.e. the Provisioning Server in this case). If the decrypted block of data corresponds to the original random block of data encrypted, the sender
of the token is considered to be allowed to use the token.
</p>
<p>
If the received of the challenge does not have access to the private certificate referenced, but used the token in a propagated request made to it, it can propagate the
request to the original sender of the token. When the response is returned, it returns the response in turn to the sender of the challenge.
</p>
<p>
A challenge/response sequence can look as follows:
</p>
<example caption='Requesting a token'>
<![CDATA[
<iq type='get'
from='provisioning.clayster.com'
to='device@clayster.com/device'
id='6'>
<tokenChallenge xmlns='urn:xmpp:iot:provisioning' token='TOKEN'>BASE-64 encoded challenge</tokenChallenge>
</iq>
<iq type='result'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='6'>
<tokenChallengeResponse xmlns='urn:xmpp:iot:provisioning'>BASE-64 encoded response</tokenChallengeResponse>
</iq>]]>
</example>
<p>
<strong>Note:</strong> It is important that a unit only responds to a <strong>tokenChallenge</strong> request from a JID to which the corresponding token
has been sent. If a token challenge is received from a JID to which the token has not been sent the last minute, the following error message must be returned:
</p>
<example caption='Invalid token challenge'>
<![CDATA[
<iq type='error'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='6'>
<error type='cancel'>
<forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>]]>
</example>
</section4>
</section3>
<section3 topic='Delegating Secondary Trust' anchor='delegatingsecondarytrust'>
<p>
2013-04-16 15:46:58 -04:00
The <strong>isFriendResponse</strong> element returned by the provisioning server contains an attribute <strong>secondaryTrustAllowed</strong> that is by default
set to false. If the provisioning server has no problem with allowing multiple trust to be delegated by devices in the network, it can choose to set this
attribute to true in the response. If true, the device knows it has the right to add its own friends, or to add secondary trust relationships.
</p>
<p>
The following diagram continues with the example given above, of how a sensor with a limited user interface, can allow to manually add new friends, including new
trust relationships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eqAUjbnySDqpB0YiagDGiWXoS06UZ/32GfrQxCIOqBOuehEvZnB7gffEXVAHRG507tM1J1E/dLFS67nH5geUQd0SYpO1Ok6MAWiDuhC1DVEna7DU0QdUMQWnag777rrtQBMg6gDihB1DYPDOvxF1AFF5h71vx8VOfjmV1VRP3s097+k+vx7uaifPyay8M7liaK+dWZZVk5vPXm0u3N6UdY2nmyuiqxeSN66uSqyeGa74v3NOz/affJo98Ja//Ysr+8QdWAUog5okS26g5P62aMiB9/6usaTuo361pllObk5sqb2/TdOJr1Pw791Zlls6RuLOl2Hd4g6oEUTUU9P6p+9eah/Bn7t8+qon3tWZOHwksjSy9fNSf3iO0vJBy388cr3Pz/4/ucPjoscP2nO08kpfOvMcvJ5V08mkbYH9OqTeun9M0f8bO8bizqHdfiLqANaNBr1zOPwVQ+/H3z7myTq8stz6cPvv3phQZZeub73XdLyT0zUk1P4xknpP3ielHt7faXwmqqol9/fPOpuH2/fXl+RRotO1OEvog5o4eqkLifeHXxSf/ajzHPqh5eyz7ov/PGKOalfeJSPuulx5jny5DWDop5//yePsq/cvbDWdNGJOvxF1AEtmo16f/z9qMjRD8eLenpSt0+oV0a9lpN64yGvjDpdh1+IOqBFo1H/6nfL9vfKhz2nnot65jl1OfzGF5VRr3iOfHt9Jf3Ft4mfU3d7Uifq8AtRB7Rw/Nvvc/w79f5vv2ejPmz0f/udkzowIaIOaBFu1JOci4z5+26bq24feyfq8BdRB7QIOeq+DaIOTxF1QAuirmcQdXiKqANaEHU9g6jDU0Qd0IKo6xl
</p>
</section3>
<section3 topic='Multiple tokens' anchor='multipletokens'>
<p>
2013-04-16 15:46:58 -04:00
When multiple trust is used, the entity (client, user, service, etc.) has one token from each provisioning server. However, when sending a token to a third party,
the sender does not know what provisioning server(s) the third party uses to check access rights and user privileges. Therefore, the client must send all tokens, separated
by a space.
</p>
<p>
When a provisioning server receives a request containing multiple tokens, the most forgiving response must be returned.
</p>
<example caption='Readout request using multiple tokens'>
<![CDATA[
<iq type='get'
from='master@clayster.com/amr'
to='device@clayster.com'
id='7'>
<req xmlns='urn:xmpp:iot:sensordata' momentary='true' serviceToken='SERVICETOKEN1 SERVICETOKEN2' userToken='USERTOKEN1' seqnr='4'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='8'>
<canRead xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' serviceToken='SERVICETOKEN1 SERVICETOKEN2' userToken='USERTOKEN1' momentary='true'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='device@clayster.com/device'
id='8'>
<canReadResponse xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' momentary='true' result='true'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='result'
from='device@clayster.com'
to='master@clayster.com/amr'
id='7'>
<accepted xmlns='urn:xmpp:iot:sensordata' seqnr='4'/>
2013-04-16 15:46:58 -04:00
</iq>]]>
</example>
</section3>
<p>
<strong>Note:</strong> When a provisioning server wants to challenge multiple tokens, separate token challenges are sent, one for each token being challenged.
</p>
</section2>
<section2 topic='Friendships' anchor='friendships'>
<section3 topic='Friendship request accepted' anchor='friendshiprequestaccepted'>
<p>
2013-04-16 15:46:58 -04:00
The following diagram displays how a friendship request from an external party can be handled, delegating the responsibility to a trusted third party:
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwMAAAFuCAIAAABStVPZAAAatklEQVR4nO3dba/kZn0HYH8ldslq118EwrZJkxB/hkpAm7YhSaGJ5m1bAjQvIEUrERpppD5B2lSVqGi2pAFSJg9sFghJyNMCAbKRti/mjO0Ze+bMOTs+t/+3r0tH2rPjh/HY+o1/57bPmeIWAMBUFak3AAAgGU0IAJiupgkVAACT0dOEzrqGTYMdCwBjowmdHTsWAMZGEzo7diwAjI0mdHbsWAAYG03o7NixADA2t9mEFrOyKGeL7oNL1XzLcvNqx8S9zKui+8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pCAQ4SnBmZFVgCEdiDZFYTCnCQ4MzIrMASiMAeJLPDNqG0snkhMBEyC4FkE1hNCBgLmYVAsgmsJgSMhcxCINkEVhMCxkJmIZBsAptzEwIA2E0TAgCmSxMCAKZLEwIApivnJpTNC4GJkFkIJJvAakLAWMgsBJJNYDUhYCxkFgLJJrCaEDAWMguBZBNYTQgYC5mFQLIJrCYEjIXMQiDZBFYTAsZCZiGQbAKbcxMCANhNEwIApksTAgCmSxMCAKYr5yaUzQuBiZBZCCSbwGpCwFjILASSTWA1IWAsZBYCySawmhAwFjILgWQTWE0IGAuZhUCyCawmBIyFzEIg2QRWEwLGQmYhkGwCm3MTAgDYTRMCAKZLEwIApksTAgCmK+cmlM0LgYmQWQgkm8BqQsBYyCwEkk1gNSFgLGQWAskmsJoQMBY
</p>
<p>
The communication between the XMPP Device and the Provisioning Server could be as follows:
</p>
<example caption='Friendship request accepted'>
<![CDATA[
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='9'>
<isFriend xmlns='urn:xmpp:iot:provisioning' jid='client1@clayster.com'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='device@clayster.com/device'
id='9'>
<isFriendResponse xmlns='urn:xmpp:iot:provisioning' jid='client1@clayster.com' result='true'/>
2013-04-16 15:46:58 -04:00
</iq>]]>
</example>
<p>
<strong>Note:</strong> The provisioning server implicitly understands which two JIDs that are to be checked: The first one is the sender of the message, the second one
is the JID available in the <strong>jid</strong> attribute in the request.
</p>
<p>
<strong>Note 2:</strong> Any resource information in the JID must be ignored by the provisioning server.
</p>
</section3>
<section3 topic='Friendship request rejected' anchor='friendshiprequestrejected'>
<p>
2013-04-16 15:46:58 -04:00
The following diagram displays a friendship request from an external party being rejected as a result of the trusted third party negating the friendship:
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwMAAAFuCAIAAABStVPZAAAbHUlEQVR4nO3da4/k1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z9879bL7916+Rdv/cv7t195//YrH/z7jz749x99+B8//vA/fvzRz37y0c9+8vHbr3789qt3fv6vy69fvvNvv3zn33717uJX7y5+/d5rv37vtd/84vXf/OL1377/xm/ff+N3H7z5uw/e/P2HP/3ko1uffHTr7sdv3f34rU/v3B7D10EOEgxNZgWWQAT2sJnVhAIcJBiazAosgQjsYTOrCQ1+kF743gvLr3O+qzAcmRVYAhHYw2ZWEwpwkGBoMiuwBCKwh82sJhTgIMHQZFZgCURgD5vZuE3o6QfrG8fv/8bvPnjz99/+wrXH//6Tj27dvXH92uP/sPf7+OJTTzwz8oMEQxsqs9//4yutX/G4+uh39/pgvXH92hMvxv1UhaGdJbD/9z/d0/6Fqz/4q9M1oW/fe/Wxv98M7KmiOkyup9yEnn6wuPSVfzw+SN+5v7j62AtNEzpVXb35yLUHNCGmbsAmdN/XVh+s3/3KPcVDfzPqHzEFlhDO2IT+4C9Xgf27xz/7mcf/nzmh5v08/qb70IUepFM1oWc/f/XR724epJ45oRefOv6B9PJTN29/euf2pzeuX7tyefnQtSderBcY7gdQH6yEcCFN6PXfPHtvcf/Xf/v+9/7i+IfTS0++dOuTj249/0eXn7z51qd3bn9685FrVx55tfnZsR3hTpwFlqk6WBP65ueufPYzRVE88K3/9eefPZ4tevDZ13793mvP3beabvjBl67e859/VM8JvfSn14pVEp/oRrV4+Ebv2bY1J9R9ql79gesPX3nkVU1onyb08qOXHny2U1c7TejVJy6v3uVnHi6uP3/n9qc3rhfLd3n5gXvHnBAcHV1YE/rHL129/+uvfPnS1cde+N0Hb/7+w298sfjC//jo1t0b14s/+u/LzD58o/nEfPWJy8UynjcfaX1oruIssEzV+a+OXfkvf/fx26/e+ebnij/8b3d+/q8//LPPFH/4tV+9u/jVu197sPj837732m+evbe47+nfvv/GK1++9NC3m6tjP3788hdvbF4da6K642zbakIbTzUn6/opTej0c0Lf+M63e5rQ8w+0L4pefupm+zrlMw9rQrBykXNCz92/FswnX7p19+N/ePLK9edbn6HLnD7/wOrny944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FVgCEdjDZlYTCnCQYGgyK7AEIrCHzawmFOAgwdBkVmAJRGAPm1lNKMBBgqHJrMASiMAeNrOaUICDBEOTWYElEIE9bGY1oQAHCYYmswJLIAJ72MxqQgEOEgxNZgWWQAT2sJnVhAIcJBiazAosgQjsYTOrCQU4SDA0mRVYAhHYw2ZWEwpwkGBoMiuwBCKwh82sJhTgIMHQZFZgCURgD5tZTSjAQYKhyazAEojAHjazmlCAgwRDk1mBJRCBPWxmh2pC1HywMn6pUzIiAsv4pU7JuIy0CdXq8SX5ar9BY/g61LsKw5FZgSUQgT1IZjWhAAcJLozMCiyBCOxBMqsJBThIcGFkVmAJRGAPktlhm1Ba2bwQmAiZhUCyCawmBIyFzEIg2QRWEwLGQmYhkGwCqwkBYyGzEEg2gc25CQEA7KYJAQDTpQkBANOlCQEA05VzE8rmhcBEyCwEkk1gNSFgLGQWAskmsJoQMBYyC4FkE1hNCBgLmYVAsgmsJgSMhcxCINkEVhMCxkJmIZBsAqsJAWMhsxBINoHNuQkBAOymCQEA06UJAQDTpQkBANOVcxPK5oXARMgsBJJNYDUhYCxkFgLJJrCaEDAWMguBZBNYTQgYC5mFQLIJrCYEjIXMQiDZBFY
</p>
<p>
The communication between the XMPP Device and the Provisioning Server could be as follows:
</p>
<example caption='Friendship request rejected'>
<![CDATA[
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='10'>
<isFriend xmlns='urn:xmpp:iot:provisioning' jid='client2@clayster.com'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='device@clayster.com/device'
id='10'>
<isFriendResponse xmlns='urn:xmpp:iot:provisioning' jid='client2@clayster.com' result='false'/>
2013-04-16 15:46:58 -04:00
</iq>]]>
</example>
</section3>
<section3 topic='Unfriending existing friends' anchor='unfriendingexistingfriends'>
<p>
2013-04-16 15:46:58 -04:00
If the provisioning server decides that two friends in the network should no longer be friends and communicate with each other, it simply sends a message to
at least one of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BIisOVmVhNKYJCgajIrsCREYMvNrCaUwCBB1WRWYEmIwJabWU0ogUGCqsmswJIQgS03s5pQAoMEVZNZgSUhAltuZjWhBAYJqiazAktCBLbczGpCCQwSVE1mBZaECGy5mdWEEhgkqJrMCiwJEdhyM6sJJTBIUDWZFVgSIrDlZlYTSmCQoGoyK7AkRGDLzawmlMAgQdVkVmBJiMCWm1lNKIFBgqrJrMCSEIEtN7OaUAKDBFWTWYElIQJbbmarakKMmVhpvrpT0iACS/PVnZJmaWgTGhsfXy1f+W9QE77K+q5CdWRWYEmIwJaSWU0ogUGCbSOzAktCBLaUzGpCCQwSbBuZFVgSIrClZLbaJlSvMCcCLSGzkJAwgdWEgKaQWUhImMBqQkBTyCwkJExgNSGgKWQWEhImsJGbEADAYpoQANBemhAA0F6aEADQXpGbUJgTgZaQWUhImMBqQkBTyCwkJExgNSGgKWQWEhImsJoQ0BQyCwkJE1hNCGgKmYWEhAmsJgQ0hcxCQsIEVhMCmkJmISFhAhu5CQEALKYJAQDtpQkBAO2lCQEA7RW5CYU5EWgJmYWEhAmsJgQ0hcxCQsIEVhMCmkJmISFhAqsJAU0hs5CQMIHVhICmkFlISJjAakJAU8gsJCRMYDUhoClkFhISJrCRmxAAwGKaEADQXpoQANBemhAA0F6Rm1CYE4GWkFlISJjAakJAU8gsJCRMYDUhoClkFhISJrCaENAUMgsJCRNYTQhoCpmFhIQJrCYENIXMQkLCBFYTApp
</p>
<p>
The provisioning server should only send such messages to clients that have previously asked the provisioning server if friendship requests should be accepted or not.
</p>
<p>
<strong>Note:</strong> The device should only honor such messages, if the sender is the trusted third party. Such messages received from other entities not trusted should
be silently ignored.
</p>
<example caption='Unfriending existing friend'>
<![CDATA[
<message from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='device@clayster.com'>
<unfriend xmlns='urn:xmpp:iot:provisioning' jid='client2@clayster.com'/>
2013-04-16 15:46:58 -04:00
</message>]]>
</example>
</section3>
<section3 topic='Recommending friendships' anchor='recommendingfriendships'>
<p>
2013-04-16 15:46:58 -04:00
The provisioning server can, apart from accepting new friendships and rejecting old friendships, also recommend new friendships. In this case, the provisioning server
simply sends a message to one or both of the soon to be friends, as follows:
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwMAAAFyCAIAAAAmoZE5AAAerUlEQVR4nO3da68k9X0n8HpLnjFopt6IjUkggKnXsFLiDbvBwNoL6qe7a+wsD2xiIQUvUkvZi03CaiVHDhMTbJM0F8MkxoDBML4D0tkH3XXpruo+fXqqTtX/V5+PRqJPd3VduvhWf+dfdaayMwCAucrGXgEAgNFoQgDAfNVNKAMAmI2OJnTZNYxJ8n8CAOFpQuzl/wQAwtOE2Mv/CQCEpwmxl/8TAAhPE2Iv/ycAEN5tNqHVIs/yxap+YllsX45dLPta00G01r8vO5/DzsewLLJTFjvY2nZRgwCYgyGaUPXEpX5zn2TQJtT7jC/v81SDAJiJY5rQapFvhjbKr+HymbwoDjWh6odqDvW01aBJNVxSD6PU78nz9RuLRbnEc17qWNayyLKiKJpLO7z+eybeTFjVkfValI92Gkq7CS2LzTrni1X96mlr294jfVKDAJiPI5pQ60t9tcg3X9J1GWhOvHtWqC4Ky2Lz1IEH5eT1vLcKVb5YnZ3zUsey6kflnA+t/+7E2zNsrt/OJHs+h2pVy9pXrvaJazvIgNOGGgTArFxsTGi32Rw4O7YsqhGL7Xa03QCay9gaFlnWDaBqCVtNqPul9rIaHatVbrrXf2vijhmu37QoNoM0rXGlrc+hY871q6eu7e4e6YsaBMDcHNOESs1BkUNjKs3TVN29p91gGm9sjrlcuAkdWtaxY0L7ikhlezio8xzVcU2ov7XtgRoEwAwd0YQaAxAnXCdUV5ft61qq4ZD2M43v/Qs3oY5raFrd4tzrhLon3rkUvNEKO85UHdeETlzb9h7ZGorbaZZHUYMAmKeLjAkRl50OwDxpQtjjAMyXJjR3djcAc6YJzZp9DcDMaULzZUcDgCY0U/YyAJzta0KEN9L/bwAwLZkxIQBgtjQhAGC+NCEA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0pgJ8HQZFZgSYjA9ptZTSiBnQRDk1mBJSEC229mNaEEdhIMTWYFloQIbL+Z1YQS2EkwNJkVWBIisP1mVhNKYCfB0GRWYEmIwPabWU0ogZ0EQ5NZgSUhAttvZjWhBHYSDE1mBZaECGy/mdWEEthJMDSZFVgSIrD9ZlYTSmAnwdBkVmBJiMD2m1lNKIGdBEOTWYElIQLbb2Y1oQR2EgxNZgWWhAhsv5nVhBLYSTA0mRVYEiKw/WZWE0pgJ8HQZFZgSYjA9ptZTSiBnQRDk1mBJSEC229mNaEEdhIMTWYFloQIbL+Z1YQS2EkwNJkVWBIisP1mVhNKYCfB0GRWYEmIwPabWU0ogZ0EQ5NZgSUhAttvZjWhBHYSDE1mBZaECGy/mdWEEthJMDSZFVgSIrD9ZlYTSmAnwdBkVmBJiMD2m1lNKIGdBEOTWYElIQLbb2aHakJUHFiZvrFTMiECy/SNnZJpmWgTqlTrN8qf5gc0hT99faowHJkVWBIisL1kVhNKYCfBpZFZgSUhAttLZjWhBHYSXBqZFVgSIrC9ZHbYJjSuMBsCMyGzkJAwgdWEgKmQWUhImMBqQsBUyCwkJExgNSFgKmQWEhImsJGbEADAYZoQADBfmhAAMF+aEAAwX5GbUJgNgZmQWUhImMBqQsBUyCwkJExgNSFgKmQWEhImsJoQMBUyCwkJE1hNCJgKmYWEhAmsJgRMhcxCQsIEVhMCpkJmISFhAhu5CQEAHKYJAQDzpQkBAPOlCQEA8xW5CYXZEJgJmYWEhAmsJgRMhcxCQsIEVhMCpkJmISFhAqsJAVMhs5CQMIHVhICpkFlISJjAakLAVMgsJCRMYDUhYCpkFhISJrCRmxAAwGGaEAAwX5oQADBfmhAAMF+
</p>
<example caption='Recommending friendships'>
<![CDATA[
<message from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='device@clayster.com'>
<friend xmlns='urn:xmpp:iot:provisioning' jid='client2@clayster.com'/>
2013-04-16 15:46:58 -04:00
</message>]]>
</example>
<p>
Note that the receptor can still ask the provisioning server if it can form a friendship with the suggested friend, using the <strong>isFriend</strong> command.
</p>
</section3>
</section2>
<section2 topic='Device Read-out' anchor='devicereadouts'>
<section3 topic='Rejecting read-outs' anchor='rejectingreadouts'>
<p>
2013-04-16 15:46:58 -04:00
An important use case for provisioning in sensor networks is who gets to read out sensor data from which sensors. This use case details how communication with a
provisioning server can help the device determine if a client has sufficient access rights to read the values of the device.
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwMAAAFuCAIAAABStVPZAAAeKklEQVR4nO3da88k1WEn8PpKnjGjmf4iNp4EApj6DCsl3rAbDMQOqN8ma+wsL2xijRS8SC1lLzYJq5UcOUxMsE3SXDyQGAPmNr4D0uyL7rp0VXU93c9T1afOqd9PI3mmL6dOVfHv+s/pGj/ZHQCAucpCTwAAIBhNCACYr6oJZQAAs9HRhE5dw2bPMQeAIDShSXDMASAITWgSHHMACEITmgTHHACC0IQmwTEHgCAu2ITWy0W2WK6rB1b57u3Y+arzfat871P7t5SvNm/c2eDIWjs4AjUIAEIZowmVDwxXI9bLxbHVaRijNyE1CAACOqQJrZeL7QpP0QmKRxZ53teEyj+UIxRP7awJtZ6tLS3lq50J5Hkx5Crf/qlaeTpjVovF5q2tzVXDH7CDg1KDACCsA5pQ6wupaoFmvVxkvd+Ola/avKgsQLUm1Pds+Ztyk6t6E6petFiuz5xVVZcam2vtaN9Qw1GDACC449aEms2m59uxVV4usey2o2pFZ1W+Y/fZjm+kupvQZoRaE+qb1d7NtReF2kOVa0RDlSI1CACm4Jj7hIo+cdbqS61E7Gs2nWtC7WfL5w5sQn2z2ru5nRWok6wJqUEAMBEHNKGjbqNp3Se0e2tO8Vz3fUKNd9Yf2T7QuE9otbPJ/lnt31yxscVikR12y1Exgd3fHHnEAYDgjlkTGtDx/4r+sDGrr+NO+U/tj6IJAcB0hGhCmzWY4f9NfMfi1dSoQQAwKYHWhGbJgQWAqdGETsRRBYAJ0oROwSEFgGnShEbneALAZHU3IQYU6MwCAGfLrAkBAL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kVmCJiMAOm1lNKIKTBGOTWYElIgI7bGY1oQhOEoxNZgWWiAjssJnVhCI4STA2mRVYIiKww2ZWE4rgJMHYZFZgiYjADptZTSiCkwRjk1mBJSICO2xmNaEIThKMTWYFlogI7LCZ1YQiOEkwNpkVWCIisMNmVhOK4CTB2GRWYImIwA6bWU0ogpMEY5NZgSUiAjtsZjWhCE4SjE1mBZaICOywmdWEIjhJMDaZFVgiIrDDZlYTiuAkwdhkVmCJiMAOm1lNKIKTBGOTWYElIgI7bGY1oQhOEoxNZgWWiAjssJnVhCI4STA2mRVYIiKww2ZWE4rgJMHYZFZgiYjADptZTSiCkwRjk1mBJSICO2xmNaEIThKMTWYFlogI7LCZ1YQiOEkwNpkVWCIisMNmVhOK4CTB2GRWYImIwA6bWU0ogpMEY5NZgSUiAjtsZsdqQpR8sDJ9oVMyIQLL9IVOybRMtAmVyvkF+VU/QFP4NdRRhfHIrMASEYEdJLOaUAQnCU5GZgWWiAjsIJnVhCI4SXAyMiuwRERgB8nsuE0orGR2BGZCZiEiyQRWEwKmQmYhIskEVhMCpkJmISLJBFYTAqZCZiEiyQQ25SYEANBPEwIA5ksTAgDmSxMCAOYr5SaUzI7ATMgsRCSZwGpCwFTILEQkmcBqQsBUyCxEJJnAakLAVMgsRCSZwGpCwFTILEQkmcBqQsBUyCxEJJnAakLAVMgsRCSZwKbchAAA+mlCAMB8aUIAwHxpQgDAfKXchJLZEZgJmYWIJBNYTQiYCpmFiCQTWE0ImAqZhYgkE1hNCJgKmYWIJBNYTQiYCpmFiCQTWE0ImAqZhYgkE1hNCJgKmYWIJBPYlJsQAEA/TQgAmC9NCACYL00IAJivlJtQMjsCMyGzEJFkAqsJAVMhsxCRZAKrCQFTIbMQkWQCqwkBUyGzEJFkAqsJAVMhsxCRZAKrCQFTIbMQkWQCqwkBUyG
</p>
<p>
<strong>Note:</strong> This use case is an extension of the use case 'Read-out rejected' in the XEP-0323
<link url='http://xmpp.org/extensions/xep-0323.html'>Internet of Things - Sensor Data</link>.
2013-04-16 15:46:58 -04:00
</p>
<p>
The following example shows the communication first between the client and the device, then between the device and the provisioning server, and last between the device and the client:
2013-04-16 15:46:58 -04:00
</p>
<example caption='Rejecting read-outs'>
<![CDATA[
<iq type='get'
from='master@clayster.com/amr'
to='device@clayster.com'
id='11'>
<req xmlns='urn:xmpp:iot:sensordata' momentary='true' serviceToken='SERVICETOKEN1' userToken='USERTOKEN1' seqnr='1'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='12'>
<canRead xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' serviceToken='SERVICETOKEN1' userToken='USERTOKEN1' momentary='true'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='device@clayster.com/device'
id='12'>
<canReadResponse xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' momentary='true' result='false'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='error'
from='device@clayster.com'
to='master@clayster.com/amr'
id='11'>
<rejected xmlns='urn:xmpp:iot:sensordata' seqnr='1'>
2013-04-16 15:46:58 -04:00
<error>Access denied.</error>
</rejected>
</iq>]]>
</example>
</section3>
<section3 topic='Restricting nodes during read-out' anchor='restrictingnodes'>
<p>
2013-04-16 15:46:58 -04:00
In case the device handles multiple nodes that can be read, the provisioning server has the possibility to grant read-out, but to limit the nodes that can be read out.
The provisioning server does this by returning the list of nodes that can be read.
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwMAAAFuCAIAAABStVPZAAAfx0lEQVR4nO3dba8k1WEn8PpKnjFopr6IjUkggKnPsFLiDbvBQOyA+m2yxs7ywibWSMGL1FL2wSZhtZIjh4kJtkmaBw8kxoB5Gj8D0t0X3fVc3bdv364+dU79fhqJO327T52qmn/Xf07XcLMzAIC5ykJPAAAgGE0IAJivugllAACzMdCETl3DmAanHoC50YSoOfUAzI0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/5xau/+cWrv33vtd++99rv3n/9d++//vsPfvrxh7c+/vDWJx+98clHb3x6+80p/DrKSYKxyazAEhGBPW5mNaEIThKMTWYFlogI7HEzqwmNfpKe+95z61+XPKowHpkVWCIisMfNrCYUwUmCscmswBIRgT1uZjWhCE4SjE1mBZaICOxxMxtvE3ry/urG8Xu/8bv3X//9t79w/dG///jDW5/cuPv6o/+w93F8/onHnpr4SYKxjZXZ7//xnY1/4nHt4e/u9cZ64+7rjz0f77sqjO2QwP7f/3RH8x9c/cFfXawJffuua4/8fTewF4rqOLmecxN68v7sylf+cXOSvnNvdu2R5+omdKG6evOh6/dpQszdiE3onq+Vb6zf/cod2QN/M+m/YgosUTiwCf3BX5aB/btHP/uZR/+fNaH6eG6+6D900pN0oSb09OevPfzd7kkaWBN6/onNX0ivPnHzzU9vv/npjbuv33l1/dD1x56vnjDeX0C9sRKFkzShV3/z9F3ZvV//7Xvf+4vNX06vPP7CrY8/vPXsH119/OYbn95+89ObD12/86GX6787NiPci7PAMldHa0Lf/Nydn/1MlmX3fet//flnN6tF9z/9yq/ffeWZe8rlhh986dod//lH1ZrQC396PSuT+Fg/qtmDNwavto01of63qpffd/eDdz70sia0TxN68eEr9z/dq6u9JvTyY1fLo/zUg9ndz95+89Mbd2fro7x+w71tTQjOzk7WhP7xS9fu/fpLX75y7ZHnfvf+67//4BtfzL7wPz689cmNu7M/+u/rzD54o37HfPmxq9k6njcfarxplnEWWObq8p+O3flf/u6jt16+/c3PZX/4327//F9/+Gefyf7wa796Z/Wrd752f/b5v333ld88fVd2z5O/fe+1l7585YFv15+O/fjRq1+80f10rI7qjqttowl1vlVfrKtvaUIXXxP6xne+PdCEnr2v+aHo1SduNj+nfOpBTQhKp1wTeubeVjAff+HWJx/9w+N33v1s4z10ndNn7yv/fjkYZ4Flri69JlQG9pufu/O//s91E7rvW+uL7P/+yh1XvvL99cfZdz3z3tcfyO76Tus+ob/+Ym9NaPN3mNtvfnr7+Sfu3HK1ba4Jtb/17H1Vop+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0QE9riZ1YQiOEkwNpkVWCIisMfNrCYUwUmCscmswBIRgT1uZjWhCE4SjE1mBZaICOxxM6sJRXCSYGwyK7BERGCPm1lNKIKTBGOTWYElIgJ73MxqQhGcJBibzAosERHY42ZWE4rgJMHYZFZgiYjAHjezYzUhKt5Ymb7QKZkQgWX6QqdkWibahCrV/IL8ah6gKfw61lGF8ciswBIRgT1KZjWhCE4SnIzMCiwREdijZFYTiuAkwcnIrMASEYE9SmbHbUJhJbMjMBMyCxFJJrCaEDAVMgsRSSawmhAwFTILEUkmsJoQMBUyCxFJJrApNyEAgN00IQBgvjQhAGC+NCEAYL5SbkLJ7AjMhMxCRJIJrCYETIXMQkSSCawmBEyFzEJEkgmsJgRMhcxCRJIJrCYETIXMQkSSCawmBEyFzEJEkgmsJgRMhcxCRJIJbMpNCABgN00IAJgvTQgAmC9NCACYr5S
</p>
<p>
<strong>Note:</strong> This use case is an extension of the use case 'Read-out of multiple devices' in the XEP-0323
<link url='http://xmpp.org/extensions/xep-0323.html'>Internet of Things - Sensor Data</link>.
2013-04-16 15:46:58 -04:00
</p>
<p>
<strong>Note 2:</strong> If the server responds, but without specifying a list of nodes, the device can assume that all nodes available in the original request are allowed
to be read. If no nodes in the request are allowed to be read, the provisioning server must respond with a result='false', so the device can reject the read-out request.
</p>
<p>
The following example shows the communication first between the client and the device, then between the device and the provisioning server, and last between the device and the client:
2013-04-16 15:46:58 -04:00
</p>
<example caption='Restricting nodes during read-out'>
<![CDATA[
<iq type='get'
from='master@clayster.com/amr'
to='device@clayster.com'
id='13'>
<req xmlns='urn:xmpp:iot:sensordata' momentary='true' serviceToken='SERVICETOKEN1' userToken='USERTOKEN1' seqnr='2'>
2013-04-16 15:46:58 -04:00
<node nodeId='Device02'/>
<node nodeId='Device03'/>
</req>
</iq>
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='14'>
<canRead xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' momentary='true' serviceToken='SERVICETOKEN1' userToken='USERTOKEN1'>
2013-04-16 15:46:58 -04:00
<node nodeId='Device02'/>
<node nodeId='Device03'/>
</canRead>
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='device@clayster.com/device'
id='14'>
<canReadResponse xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' momentary='true' result='true'>
2013-04-16 15:46:58 -04:00
<node nodeId='Device02'/>
</canReadResponse>
</iq>
<iq type='result'
from='device@clayster.com'
to='master@clayster.com/amr'
id='13'>
<accepted xmlns='urn:xmpp:iot:sensordata' seqnr='2'/>
2013-04-16 15:46:58 -04:00
</iq>]]>
</example>
<p>
Note that the provisioning server responds with a <strong>canReadResponse</strong> element, similar to the <strong>canRead</strong> element in the request, except
only the nodes allowed to be read are read. The device must only permit read-out of nodes listed in the response from the provisioning server. Other nodes available
in the request should be ignored.
</p>
</section3>
<section3 topic='Restricting fields during read-out' anchor='restrictingfields'>
<p>
2013-04-16 15:46:58 -04:00
In case the provisioning server wants to limit the fields a device can send to a client, the provisioning server has the possibility to grant read-out, but
list a set of fields the device is allowed to send to the corresponding client.
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwMAAAFuCAIAAABStVPZAAAfx0lEQVR4nO3dba8k1WEn8PpKnjFopr6IjUkggKnPsFLiDbvBQOyA+m2yxs7ywibWSMGL1FL2wSZhtZIjh4kJtkmaBw8kxoB5Gj8D0t0X3fVc3bdv364+dU79fhqJO327T52qmn/Xf07XcLMzAIC5ykJPAAAgGE0IAJivugllAACzMdCETl3DmAanHoC50YSoOfUAzI0mRM2pB2BuNCFqTj0Ac6MJUXPqAZibSzah1SLP8sWq/2CWZVmxPMYMu0MXy7OzZZH1N7vDssjKl7Umtc84jeccuPXLGjzIe73sQmdADQJghkZoQqtFnmVFMUJdWI988X61WuT5YjXQhE6y9Us7qAldcLZqEADztE8TKtd46mpTPpIXRe8iXV6CWysny2IzQnVt7j1SbaV80bLYFKrNs+pp1DWr+5zB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Hnpr4SYKxjZXZ7//xnY1/4nHt4e/u9cZ64+7rjz0f77sqjO2QwP7f/3RH8x9c/cFfXawJffuua4/8fTewF4rqOLmecxN68v7sylf+cXOSvnNvdu2R5+omdKG6evOh6/dpQszdiE3onq+Vb6zf/cod2QN/M+m/YgosUTiwCf3BX5aB/btHP/uZR/+fNaH6eG6+6D900pN0oSb09OevPfzd7kkaWBN6/onNX0ivPnHzzU9vv/npjbuv33l1/dD1x56vnjDeX0C9sRKFkzShV3/z9F3ZvV//7Xvf+4vNX06vPP7CrY8/vPXsH119/OYbn95+89ObD12/86GX6787NiPci7PAMldHa0Lf/Nydn/1MlmX3fet//flnN6tF9z/9yq/ffeWZe8rlhh986dod//lH1ZrQC396PSuT+Fg/qtmDNwavto01of63qpffd/eDdz70sia0TxN68eEr9z/dq6u9JvTyY1fLo/zUg9ndz95+89Mbd2fro7x+w71tTQjOzk7WhP7xS9fu/fpLX75y7ZHnfvf+67//4BtfzL7wPz689cmNu7M/+u/rzD54o37HfPmxq9k6njcfarxplnEWWObq8p+O3flf/u6jt16+/c3PZX/4327//F9/+Gefyf7wa796Z/Wrd752f/b5v333ld88fVd2z5O/fe+1l7585YFv15+O/fjRq1+80f10rI7qjqttowl1vlVfrKtvaUIXXxP6xne+PdCEnr2v+aHo1SduNj+nfOpBTQhKp1wTeubeVjAff+HWJx/9w+N33v1s4z10ndNn7yv/fjkYZ4Flri69JlQG9pufu/O//s91E7rvW+uL7P/+yh1XvvL99cfZdz3z3tcfyO76Tus+ob/+Ym9NaPN3mNtvfnr7+Sfu3HK1ba4Jtb/17H1Vop+yJnT4fULZvd/YuSZU/tKEYMgp7xNqrAnVtx385NGrD97XfaOsI9xaExrxl8AShTGaUHdN6Bev/svDVx64965rX/7e8B3TN+6uUjm4JrR/E7ImNOq/Has/ucy2nZubD13Psmy0MuSNlSiM2IQaKzn3P73+20t1n1CWrT8d++iNT24+dL15P9+u+4TKOAssc3X0JvTLt7v3CW0+zs6ufPUHrX879uNHr9Z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4SnIzMCiwREdijZFYTiuAkwcnIrMASEYE9SmbHbUJhJbMjMBMyCxFJJrCaEDAVMgsRSSawmhAwFTILEUkmsJoQMBUyCxFJJrApNyEAgN00IQBgvjQhAGC+NCEAYL5SbkLJ7AjMhMxCRJIJrCYETIXMQkSSCawmBEyFzEJEkgmsJgRMhcxCRJIJrCYETIXMQkSSCawmBEyFzEJEkgmsJgRMhcxCRJIJbMpNCABgN00IAJgvTQgAmC9NCACYr5S
</p>
<p>
<strong>Note:</strong> If the server responds, but without specifying a list of field names, the device can assume that all fields available in the original request are allowed
to be sent. If no fields in the request are allowed to be sent, the provisioning server must respond with a result='false', so the device can reject the read-out request.
</p>
<p>
The following example shows the communication first between the client and the device, then between the device and the provisioning server, and last between the device and the client:
2013-04-16 15:46:58 -04:00
</p>
<example caption='Restricting fields during read-out'>
<![CDATA[
<iq type='get'
from='master@clayster.com/amr'
to='device@clayster.com'
id='15'>
<req xmlns='urn:xmpp:iot:sensordata' momentary='true' serviceToken='SERVICETOKEN1' userToken='USERTOKEN1' seqnr='3'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='16'>
<canRead xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' momentary='true' serviceToken='SERVICETOKEN1' userToken='USERTOKEN1'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='device@clayster.com/device'
id='16'>
<canReadResponse xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' momentary='true' result='true'>
2013-04-16 15:46:58 -04:00
<field name='Energy'/>
<field name='Power'/>
</canReadResponse>
</iq>
<iq type='result'
from='device@clayster.com'
to='master@clayster.com/amr'
id='15'>
<accepted xmlns='urn:xmpp:iot:sensordata' seqnr='3'/>
2013-04-16 15:46:58 -04:00
</iq>]]>
</example>
<p>
Note that the provisioning server responds with a <strong>canReadResponse</strong> element, similar to the <strong>canRead</strong> element in the request, except only
the fields allowed to be sent are listed. The client must only send fields having field names in this list.
</p>
<p>
Also note, that the provisioning server can return a list of both allowed nodes and allowed field names in the response. In this case, the device must only send allowed fields
2013-04-16 15:46:58 -04:00
from allowed nodes, and ignore all other fields and/or nodes.
</p>
</section3>
</section2>
<section2 topic='Device Control' anchor='devicecontrol'>
<section3 topic='Rejecting control actions' anchor='rejectingcontrolactions'>
<p>
2013-04-16 15:46:58 -04:00
An important use case for provisioning in sensor networks is who gets to control devices, and what they can control. This use case details how communication with a
provisioning server can help the device determine if a client has sufficient access rights to perform control actions on the device.
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwMAAAFECAIAAAD0gnWJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAACB9SURBVHhe7d19jCPnQcfxMQpvBaUUCkKg0OTO3qSu/2mhVWurzTVNc9hL6CakKxAo26itnYQ0XhKupLCg/nFA4Ghqh5DUbsKxBQRyQ7ul7LqXNM2F6tyqqPQf17lb+/JCRIWgQDnxTqTlefPM2DP2ene9u555vh+dcvP6zPPM5tnnt8/4dhJbW1sOAACAlb7N/A0AAGAfkhAAALCX93QskUjoBQAAgNjTEWggCfGZoajjiwgAwCTcEZOnYwAAwF4kIQAAYC+SEAAAsBdJCAAA2Gt3SahXzSVy1Z5ZE5qlxIBS0+wYJA8bsWsEcSV5gjxx4IL7ylx0vN1Waf9aJO47H5cGAGBHpjgnlK10xUAsdCvZ+snQQT5f29qq5c3KBHrVpeWWXJAnnisn1cb95l50P+xbi4hBAADswpgkJCd+tP7cRX9L7lRHrY/Q7Zgg4ZbQL2BgTiiwV+9X1EEmNdQLiVKpP4OiSpBr7lFerUqloZmq4QIHtphDhwscvmhOFO5eWRu6hsu7Yd4hgxUIa9E0iPKJQQAA7IaaxZH8y9JG0TfNI3UrWccpbvSXBvbJg33co/RBcq/a5C6M3+suuJeUW9TRcsE7SGzarlaDBboL7vUD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1YvALOGPuuiw2L20WH99t5n3dgzzST
<!-- sensor-network-provisioning-15.png-->
</p>
<p>
The following example shows the communication first between the client and the device, then between the device and the provisioning server, and last between the device and the client:
2013-04-16 15:46:58 -04:00
</p>
<example caption='Rejecting control action'>
<![CDATA[
<iq type='set'
from='master@clayster.com/amr'
to='device@clayster.com'
id='17'>
<set xmlns='urn:xmpp:iot:control' xml:lang='en'>
2013-04-16 15:46:58 -04:00
<boolean name='Output' value='true'/>
</set>
</iq>
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='18'>
<canControl xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' serviceToken='SERVICETOKEN1' userToken='USERTOKEN1'>
2013-04-16 15:46:58 -04:00
<parameter name='Output'/>
</canControl>
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='device@clayster.com/device'
id='18'>
<canControlResponse xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' result='false'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='error'
from='device@clayster.com'
2013-04-16 15:46:58 -04:00
to='master@clayster.com/amr'
id='17'>
<setResponse xmlns='urn:xmpp:iot:control' responseCode='InsufficientPrivileges'/>
2013-04-16 15:46:58 -04:00
</iq>]]>
</example>
</section3>
<section3 topic='Restricting nodes during control' anchor='restrictingnodescontrol'>
<p>
2013-04-16 15:46:58 -04:00
In case the device handles multiple nodes that can be read, the provisioning server has the possibility to grant control access, but to limit the nodes that can be controlled.
The provisioning server does this by returning the list of nodes that can be controlled.
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwMAAAF1CAIAAAA7pKGBAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAACidSURBVHhe7d19kGtnYd/xo47TpmnHJC3NdJpx8Iu0Nov+IW0YkAZswPhG2jisXbOTTjtePIAOdoy1MbnEJNsOf9wkbm4xkuPaSEDdJem0I1z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sGAABOR/a+al6/C/Cuy488MEUMmjmSEAAAOHnvfmI+3gJIEgIAAPYiCQEAAHuRhAAAgL1IQgAA2O7pj5uPTP6xN37gsak+myz9SEIAANjt2X9+h/MF9ZHJV/7iOyv/8d4nrfrv3ElCAADY7fob3v78Syb9XP/Bb35Nf+KY/NRk9V+hmk9Ndp75pPcpqt4nIuuPTx79wefmk1nnG0kIAAC7XffBZx9zKsNPx6589sGn7rioPh7HfGqy8O23VOW/e3/qpgcfDT4+2Un84HN15BOhjxScWyQhAACsd/0Hn9VPx37wS5f/0a9fECnnBfmpyWpO6IOfd17YU9NC77hRfZb9bR995HsX/I9PTv7gc31kGpCEAACw2ouNtfc2XjErznU3/az8K3uj/NRkNSf0yl/98MsPyM9n9V1bvjP4+OS0f/A5SQgAAKtd77Z+de+93r8de8/lX/mNM45zw0cfuesrek7oTf6nJvuyZ4KPT570g8/nFZ/AeizETwMf6Ij5J/oLfVagwyIVRGehw2oz6bPiXvgEVgAAYDu
<!-- sensor-network-provisioning-14.png-->
</p>
<p>
<strong>Note:</strong> If the server responds, but without specifying a list of nodes, the device can assume that all nodes available in the original request are allowed
to be controlled. If no nodes in the request are allowed to be controlled, the provisioning server must respond with a result='false', so the device can reject the read-out request.
The same is true for parameters: If the provisioning server does not specify parameters in the response, the caller can assume all parameters are allowed.
</p>
<p>
The following example shows the communication first between the client and the device, then between the device and the provisioning server, and last between the device and the client:
</p>
<example caption='Restricting nodes during control'>
<![CDATA[
2013-04-16 15:46:58 -04:00
<iq type='set'
from='master@clayster.com/amr'
to='concentrator@clayster.com'
id='19'>
<set xmlns='urn:xmpp:iot:control' xml:lang='en'>
2013-04-16 15:46:58 -04:00
<node nodeId='DigitalOutput1'/>
<node nodeId='DigitalOutput2'/>
<node nodeId='DigitalOutput3'/>
<node nodeId='DigitalOutput4'/>
<boolean name='Output' value='true'/>
</set>
</iq>
<iq type='get'
from='concentrator@clayster.com/plc'
to='provisioning.clayster.com'
id='20'>
<canControl xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' serviceToken='SERVICETOKEN1' userToken='USERTOKEN1'>
2013-04-16 15:46:58 -04:00
<node nodeId='DigitalOutput1'/>
<node nodeId='DigitalOutput2'/>
<node nodeId='DigitalOutput3'/>
<node nodeId='DigitalOutput4'/>
<parameter name='Output'/>
</canControl>
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='concentrator@clayster.com/plc'
id='20'>
<canControlResponse xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' result='true'>
2013-04-16 15:46:58 -04:00
<node nodeId='DigitalOutput2'/>
<node nodeId='DigitalOutput3'/>
</canControlResponse>
</iq>
<iq type='result'
from='concentrator@clayster.com'
to='master@clayster.com/amr'
id='19'>
<setResponse xmlns='urn:xmpp:iot:control' responseCode='OK'>
2013-04-16 15:46:58 -04:00
<node nodeId='DigitalOutput2'/>
<node nodeId='DigitalOutput3'/>
</setResponse>
</iq>]]>
</example>
<p>
Note that the provisioning server responds with a <strong>canControlResponse</strong> element, similar to the <strong>canControl</strong> element in the request, except
only the nodes allowed to be controlled are included. The device must only permit control of nodes listed in the response from the provisioning server. Other nodes available
in the request should be ignored.
</p>
<p>
Also note, that the restricted set of nodes and/or parameters returned from the provisioning server must be returned to the original caller, so it can
act on the information that only a partial control action was allowed and taken.
</p>
</section3>
<section3 topic='Restricting parameters during control' anchor='restrictingparameterscontrol'>
<p>
In case the provisioning server wants to limit the control parameters a client can control in a device, the provisioning server has the possibility to grant
control access, but list a set of parameters the client is allowed to control in the corresponding device.
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwMAAAF1CAIAAAA7pKGBAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAACidSURBVHhe7d19kGtnYd/xo47TpmnHJC3NdJpx8Iu0Nov+IW0YkAZswPhG2jisXbOTTjtePIAOdoy1MbnEJNsOf9wkbm4xkuPaSEDdJem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wLnzsGAABOR/a+al6/C/Cuy488MEUMmjmSEAAAOHnvfmI+3gJIEgIAAPYiCQEAAHuRhAAAgL1IQgAA2O7pj5uPTP6xN37gsak+myz9SEIAANjt2X9+h/MF9ZHJV/7iOyv/8d4nrfrv3ElCAADY7fob3v78Syb9XP/Bb35Nf+KY/NRk9V+hmk9Ndp75pPcpqt4nIuuPTx79wefmk1nnG0kIAAC7XffBZx9zKsNPx6589sGn7rioPh7HfGqy8O23VOW/e3/qpgcfDT4+2Un84HN15BOhjxScWyQhAACsd/0Hn9VPx37wS5f/0a9fECnnBfmpyWpO6IOfd17YU9NC77hRfZb9bR995HsX/I9PTv7gc31kGpCEAACw2ouNtfc2XjErznU3/az8K3uj/NRkNSf0yl/98MsPyM9n9V1bvjP4+OS0f/A5SQgAAKtd77Z+de+93r8de8/lX/mNM45zw0cfuesrek7oTf6nJvuyZ4KPT570g8/nFZ/AeizETwMf6Ij5J/oLfVagwyIVRGehw2oz6bPiXvgEVgAAYDuSEAAAsBdJCAAA2I
<!-- sensor-network-provisioning-14.png-->
</p>
<p>
<strong>Note:</strong> If the server responds, but without specifying a list of nodes, the device can assume that all nodes available in the original request are allowed
to be controlled. If no nodes in the request are allowed to be controlled, the provisioning server must respond with a result='false', so the device can reject the read-out request.
The same is true for parameters: If the provisioning server does not specify parameters in the response, the caller can assume all parameters are allowed.
</p>
<p>
The following example shows the communication first between the client and the device, then between the device and the provisioning server, and last between the device and the client:
</p>
2013-04-16 15:46:58 -04:00
<example caption='Restricting parameters during control'>
<![CDATA[
<iq type='set'
from='master@clayster.com/amr'
to='plc@clayster.com'
id='21'>
<set xmlns='urn:xmpp:iot:control' xml:lang='en'>
2013-04-16 15:46:58 -04:00
<boolean name='DigitalOutput1' value='true'/>
<boolean name='DigitalOutput2' value='true'/>
<boolean name='DigitalOutput3' value='true'/>
<boolean name='DigitalOutput4' value='true'/>
<int name='AnalogOutput1' value='65535'/>
<int name='AnalogOutput2' value='65535'/>
<int name='AnalogOutput3' value='65535'/>
<int name='AnalogOutput4' value='65535'/>
</set>
</iq>
<iq type='get'
from='plc@clayster.com/plc'
to='provisioning.clayster.com'
id='22'>
<canControl xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' serviceToken='SERVICETOKEN1' userToken='user0001'>
2013-04-16 15:46:58 -04:00
<parameter name='DigitalOutput1'/>
<parameter name='DigitalOutput2'/>
<parameter name='DigitalOutput3'/>
<parameter name='DigitalOutput4'/>
<parameter name='AnalogOutput1'/>
<parameter name='AnalogOutput2'/>
<parameter name='AnalogOutput3'/>
<parameter name='AnalogOutput4'/>
</canControl>
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='plc@clayster.com/plc'
id='22'>
<canControlResponse xmlns='urn:xmpp:iot:provisioning' jid='master@clayster.com' result='true'>
2013-04-16 15:46:58 -04:00
<parameter name='DigitalOutput1'/>
<parameter name='DigitalOutput2'/>
<parameter name='DigitalOutput3'/>
<parameter name='DigitalOutput4'/>
</canControlResponse>
</iq>
<iq type='result'
from='plc@clayster.com'
to='master@clayster.com/amr'
id='21'>
<setResponse xmlns='urn:xmpp:iot:control' responseCode='OK'>
2013-04-16 15:46:58 -04:00
<parameter name='DigitalOutput1'/>
<parameter name='DigitalOutput2'/>
<parameter name='DigitalOutput3'/>
<parameter name='DigitalOutput4'/>
</setResponse>
</iq>]]>
</example>
<p>
Note that the provisioning server responds with a <strong>canControlResponse</strong> element, similar to the <strong>canControl</strong> element in the request, except only
the parameters allowed to be sent are listed. The device must only control parameters included in this list.
</p>
<p>
Also note, that the provisioning server can return a list of both allowed nodes and allowed parameter names in the response back to the client, so it can
2013-04-16 15:46:58 -04:00
act on the information that only a partial control action was allowed and taken.
</p>
</section3>
</section2>
<section2 topic='Cache' anchor='cache'>
<section3 topic='Clear cache' anchor='clearcache'>
<p>
2013-04-16 15:46:58 -04:00
When the provisioning server updates access rights and user privileges in the system, it will send a <strong>clearCache</strong> command to corresponding devices.
If a device was offline during the change, the provisioning server must send the <strong>clearCache</strong> message when the device comes online again. To acknowledge
the receipt of the command, the client responds with a <strong>clearCacheResponse</strong> element. This response message does not contain any information on what was
done by the client. It simply acknowledges the receipt of the command, to make sure the provisioning server does not resend the clear cache command again.
</p>
<p>
<strong>Note:</strong> The <strong>clearCache</strong> command does not include information on what has been changed, so the device needs to clear the entire cache. This
to avoid complexities in making sure updates made to the provisioning rules works in all cases, and to minimize complexity in the implementation of the protocol on the sensor side.
It is also not deemed to decrease network performance, since changing provisioning rules for a device is an exceptional event and therefore does not affect performance during
normal operation.
</p>
<example caption='Clear cache'>
<![CDATA[
<iq type='set'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='device@clayster.com'
id='23'>
<clearCache xmlns='urn:xmpp:iot:provisioning'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='result'
from='device@clayster.com'
to='provisioning.clayster.com'
id='23'>
<clearCacheResponse xmlns='urn:xmpp:iot:provisioning'/>
2013-04-16 15:46:58 -04:00
</iq>]]>
</example>
</section3>
</section2>
<section2 topic='Services' anchor='services'>
<section3 topic='Getting a service token' anchor='servicetoken'>
2013-04-16 15:46:58 -04:00
<p>
A service requesting provisioning assistance, needs to retrieve a service token from the provisioning server, by providing a base-64 encoded X.509 certificate.
The following example shows how this can be done.
</p>
2013-04-16 15:46:58 -04:00
<example caption='Requesting a service token'>
<![CDATA[
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='24'>
<getToken xmlns='urn:xmpp:iot:provisioning'>BASE-64 ENCODED PUBLIC X.509 CERTIFICATE</getToken>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='result'
from='provisioning.clayster.com'
to='device@clayster.com/device'
id='24'>
<getTokenChallenge xmlns='urn:xmpp:iot:provisioning' seqnr='1'>BASE-64 ENCODED CHALLENGE</getTokenChallenge>
</iq>
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
id='25'>
<getTokenChallengeResponse xmlns='urn:xmpp:iot:provisioning' seqnr='1'>BASE-64 ENCODED RESPONSE</getTokenChallengeResponse>
</iq>
<iq type='result'
from='provisioning.clayster.com'
to='device@clayster.com/device'
id='25'>
<getTokenResponse xmlns='urn:xmpp:iot:provisioning' token='TOKEN'/>
2013-04-16 15:46:58 -04:00
</iq>]]>
</example>
2013-04-16 15:46:58 -04:00
</section3>
<section3 topic='User access to service' anchor='usertoken'>
<p>
Provisioning in sensor networks also requires control of user access to different services in the network. This use case shows how service access rights are controlled using
a trusted provisioning server.
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA2QAAAHFCAIAAAASVa39AAAgAElEQVR4nO3dbZM0Z3ke4P5L6EEqqf8IFrLBAtS/IVWYWAkGFDBUf00Cjs0Hg21VLEdVXeXENopJpYLLRgYDlt2SQJLNu4QkY4QlVW0+zPR79+zs7sz23dceR6lKszM93T095959Pvf07mYXAACwIFt7BwAASJeyCADAoq4sZgAA0Jgpi7fdVDkdbx8AcELKYjTePgDghJTFaLx9AMAJKYvRePsAgBNSFqPx9gEAJ3TDsliXeZaXdXdHVWTtHXWZZ1lRnWQ/b1Vd5rex2/1jdSKaIgBwWsrixEZ3W1MEAM7gmLJYl/n+t+wMamCWZXlRHFUWl9fQ3lEVWZbn+XCurXted3dV7O9p+9zknsnKD+3AaHKvu7+oujVPZgCv9orKotm5frs+6cyipggAnMMRZXHSaUYl8PKyOLuG3R1VU6OqIluez+tWMFh+/sbCyoe17EBRG+z2tOItH5MDr6i5s1vl4X24Ik0RADiTq80sdhVxX3ImLap/R3d7vIZuxq6dihvUqLlN52U9s72Ze2ZWPtmBuXsG2yyqySTgYLGrvqLdysrBak5UFjVFAOB8jimLjf7U3dLMYv+Cv/n5vOHk3+Sh2ftmZhbbVUzumVn5ga1M75mZEF1e5dGvqGmXvW2doixqigDAWR1RFmcuHFy+ZvFiMMnWm39cusKvuWd2ZrFZVZ4PK+jwMsLJPZOVT3dg7mrI0VYH1yzOzT5e8RVNumF7x4EbB2mKAMC5XWVmkcR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This can be done using XMPP, HTTP, HTTPS or some other means. The service need to extract some form of identifying
credentials from the user, and provide that to the provisioning server. The provisioning server determines if the client has access rights to the service based on these
credentials, and also provides the service with a <strong>userToken</strong> that the service can use in further communication with the provisioning server regarding
the user and its privileges.
</p>
<p>
The following table lists some different types of credentials that the service can extract from the client:
</p>
<table caption='User Credentials'>
<tr>
<th>Type</th>
<th>Protocols</th>
<th>Description</th>
</tr>
<tr>
<td>JID</td>
<td>XMPP</td>
<td>Allows provisioning to be done on the JID the user has.</td>
</tr>
<tr>
<td>IP Address</td>
<td>HTTP, HTTPS</td>
<td>Allows provisioning to be done on IP address or IP-ranges for instance.</td>
</tr>
<tr>
<td>Host Name</td>
<td>HTTP, HTTPS with DNS</td>
<td>If the service has access to the client host name, for instance in an intra network, this can be used for provisioning.</td>
</tr>
<tr>
<td>X.509 Certificate</td>
<td>HTTPS</td>
<td>If the client provides a client certificate, such a certificate can be used to provide provisioning.</td>
</tr>
<tr>
<td>X.509 Certificate Thumbprint</td>
<td>HTTPS</td>
<td>
The client can also choose to validate the certificate itself and only send the certificate thumbprint to the provisioning server. Even though this
provides somewhat lesser security than providing the entire certificate, it might be an option to distribute certificate validation checks across the network
to lower the work load on the provisioning server.
</td>
</tr>
<tr>
<td>User Name</td>
<td>HTTP, HTTPS, XMPP</td>
<td>
If authenticated HTTP(S) access is implemented, the service can provide the user name as credentials. XMPP based clients can use
information in the roster to provide user name information to the provisioning server.
</td>
</tr>
<tr>
<td>Geolocation</td>
<td>HTML5 over HTTP(S), XMPP</td>
<td>
If the geographic location (longitude, latitude and possibly altitude) of the user client is known, it can be used. HTML 5 provides mechanism whereby the location
of the client can be fetched. &xep0080; provides a mechanism whereby client location can be obtained over XMPP.
</td>
</tr>
<tr>
<td>SSO Token</td>
<td>Intranet</td>
<td>If a single sign on token is available, such a token could be provided as credentials.</td>
</tr>
<tr>
<td>Protocol</td>
<td>Any</td>
<td>Connection protocol used to connect to the service.</td>
</tr>
</table>
<p>
The provisioning server receives these credentials, and decides if the user should have access to the service or not, based on rules configured in the provisioning service.
If the user is granted access, a <strong>userToken</strong> is generated and returned to the service.
2013-04-16 15:46:58 -04:00
</p>
<p>
Now, the service can determine if this access grant is sufficient or not. It can require the user to login into the service first. If so, the service should provide the provisioning
server with the user name used during login, when logged in.
</p>
<example caption='User access to service'>
<![CDATA[
<!-- user connects to service -->
<iq type='get'
from='service@clayster.com/service'
to='provisioning.clayster.com'
id='26'>
<canAccess xmlns='urn:xmpp:iot:provisioning' serviceToken='SERVICETOKEN1'>
2013-04-16 15:46:58 -04:00
<credentials type='IpAddress' value='10.0.0.1'/>
<credentials type='Longitude' value='123.45'/>
<credentials type='Latitude' value='67.89'/>
</canAccess>
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='service@clayster.com/service'
id='26'>
<canAccessResponse xmlns='urn:xmpp:iot:provisioning' userToken='USERTOKEN1' result='true'/>
2013-04-16 15:46:58 -04:00
</iq>
<!-- user performs login into service -->
<message from='service@clayster.com/service'
to='provisioning.clayster.com'>
<userLoggedIn xmlns='urn:xmpp:iot:provisioning' serviceToken='SERVICETOKEN1' userToken='USERTOKEN1' userName='Kermit' />
2013-04-16 15:46:58 -04:00
</message>
<!-- user continues interacting with service -->]]>
</example>
</section3>
</section2>
<section2 topic='User privileges' anchor='userprivileges'>
<section3 topic='User privileges in service' anchor='userpriviliegesservices'>
<p>
2013-04-16 15:46:58 -04:00
When a user has been given access to a service, and properly been identified, the service can ask the provisioning service for detailed user privileges to control
different aspects of the service. This can be done using the <strong>hasPrivilege</strong> command. Here, the service sends its <strong>serviceToken</strong> and
the <strong>userToken</strong> earlier received when being granted access to the service. Furthermore a <strong>privilegeId</strong> has to be provided.
</p>
<p>
A <strong>Privilege ID</strong> is a string composed of one or a sequence of parts, delimited by period characters. The Privilege IDs form a tree of privileges,
using an invisible, but common, root privilege.
</p>
<p>
The following table suggests some examples of Privilege IDs, with suggestive descriptions. (Only used as an example.)
2013-04-16 15:46:58 -04:00
</p>
<table caption='Privilege ID examples'>
<tr>
<th>Privilege ID</th>
<th>Description</th>
</tr>
<tr>
<td>Databases.Energy.Select</td>
<td>Gives the user the rights to select data from the Energy database.</td>
</tr>
<tr>
<td>Databases.Energy.Insert</td>
<td>Gives the user the rights to insert data into the Energy database.</td>
</tr>
<tr>
<td>Databases.Energy.Delete</td>
<td>Gives the user the rights to delete data from the Energy database.</td>
</tr>
</table>
<p>
<strong>Note:</strong> Note that privilege IDs are local to the service. Different services are allowed to use similar or same Privilege IDs, in different contexts and
with different meanings. The provisioning server must separate Privilege IDs from different services.
</p>
<p>
The client must always provide full Privilege IDs to the provisioning server. The provisioning server however, can grant partial privilege IDs, pointing to parent
privilege nodes to a user or a role object, granting a user a specific role. If granting a parent privilege ID to a user or role, this is interpreted as
giving the corresponding user or role the privileges of the entire sub-tree defined by the parent privilege ID.
</p>
<p>
If additional control over privileges is desired, negative privileges can be assigned to the user or role. Granted or explicitly rejected privileges are specified in a
sequential list of full or partial privilege IDs. This list is then processed sequentially to determine if a privilege is granted or not.
</p>
<p>
Example: Consider the privileges above. Give a user or its corresponding role the following privileges in a sequential list:
</p>
<ul>
<li>Exclude: Databases.Energy.Delete</li>
<li>Include: Databases.Energy</li>
</ul>
<p>
This would give the user rights to select and insert data, but not to delete data from the Energy database.
</p>
<p>
<strong>Note:</strong> Care should be taken when constructing Privilege IDs, so they do not include variable data that potentially can create an infinite amount of
privilege IDs. For example: Do not include user names, sensor IDs, etc., in privilege IDs, as the number of such entities cannot be estimated or is scalable beforehand.
</p>
<p>
The following diagram shows an example of how a service asks permission from a provisioning server before an action is taken:
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA2QAAAILCAIAAAAIX8ikAAAgAElEQVR4nO3dbZM0Z3ke4P5L6EEqqf8IFrLBAtS/IVWYWAkGFDDUfE0Cjs0Hg21VLEdVU+XENopJpYLLRgYDlj2SQJLNu4QkY4QlVW0+zEv3TE/Pzu7O7tx99n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aTWPVEt1pLv609DVh/9g55rFqlp/DN1WwGcff6j93/RtrlmsqvXH0MriGfSPf+zPiEI4rTqt5pFqqY4k2KcNdlpZ3Hvwo35GlMP0cVrNI9VSHUmwTxvsSZTFA7fD8Uwfp9U8Ui3VkQT7tMGOKosHjny8T4pymD5Oq3mkWqojCfZpgz2VsnjpT+FSpo/Tah6plupIgn3aYEeVRbhVpo/Tah6plupIgn3aYCuLcCzTx2k1j1RLdSTBPm2wlUU4lunjtJpHqqU6kmCfNtjKIhzL9HFazSPVUh1JsE8bbGURjmX6OK3mkWqpjiTYpw22sgjHMn2cVvNItVRHEuzTBltZhGOZPk6reaRaqiMJ9mmDPeayuJjVzbz7XT1bnPFwiGf6OK3mkWqpjiTYpw22sgjHMn2cVvNItVRHEuzTBjuuLC5mdbVUzxabb9Y1ct7UdV1VVed+cCzTx2k1j1RLdSTBPm2w08pi97bOWuO8WfbD9b/hGkwfp9U8Ui3VkQT7tMFOK4sXF/NmvbJYr9cY28XFeeOjaq7N9HFazSP
</p>
<example caption='User privileges in service'>
<![CDATA[
<!-- user wants to perform action -->
<iq type='get'
from='service@clayster.com/service'
to='provisioning.clayster.com'
id='27'>
<hasPrivilege xmlns='urn:xmpp:iot:provisioning' serviceToken='SERVICETOKEN1' userToken='USERTOKEN1' privilegeId='Sensors.View'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='service@clayster.com/service'
id='27'>
<hasPrivilegeResponse xmlns='urn:xmpp:iot:provisioning' result='true'/>
2013-04-16 15:46:58 -04:00
</iq>
<!-- user performs action -->]]>
</example>
</section3>
<section3 topic='Download all user privileges' anchor='downloadall'>
<p>
2013-04-16 15:46:58 -04:00
To improve performance, services can download the entire set of user privileges, and perform privilege checks internally. The following diagram displays
how the above two use cases could be handled in such a case:
</p>
<p>
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA2QAAAMvCAIAAAAyFYQwAAAgAElEQV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b4z+sZvTH3qe/IPzb73dLjn8E5fRgp25LD5keS8E4WPVx2o+Ui3VKd022L/1k+8aX4b+g597x7t+7jP/8Fd//L1v/fMfL374U9/+2ve7fz27fXD889D9P689+Lt/T/13tpXF6+jf1f7fC3H4WPWxmo9US3VKrxXsX/pA8Z5PfuPL/+ZHhv+s8xu/8LmvfX/0tyvf+6m2Gn7q/aMlP/a54R/3ixvs5GXxIcXbIQgfqz5W85FqqU7pdsH+vZ/+gXf9zL9vg/0bP//O93xyNLPYBntQAb/wkTc++P7Tl4OZxfZ/yuImJuPf+9shDh+rPlbzkWqpTum1fhu6+MC/nNyzWBTtZei+An7uQ+/u/0xfd89iUbSXoZXFDczHv/d3RBA+Vn2s5iPVUp2SYF832NnK4uLgd/2OiMPZx8dqPlIt1SkJ9nWDfRdl8czzcDlnHx+r+Ui1VKck2NcNdqqyeGbk+31TxOHs42M1H6mW6pQE+7rBvpey+Oir8ChnHx+r+Ui1VKck2NcNdqqyCDfl7ONjNR+pluqUBPu6wVYW4VLOPj5W85FqqU5JsK8bbGURLuXs42M1H6mW6pQE+7rBVhbhUs4+PlbzkWqpTkmwrxtsZREu5ezjYzUfqZbqlAT7usFWFuFSzj4+VvORaqlOSbCvG2xlES7l7ONjNR+pluqUBPu6wd5zWTzUZdUMvyrrw4bDIT1
</p>
<p>
<strong>Note:</strong> When downloading privileges using this command, a sequential list of full or partial privilege IDs will be returned together with the
corresponding include or exclude flags. The above mentioned algorithm of determining user privileges must be implemented by the service, if this method is
to be used.
</p>
<example caption='Download all user privileges'>
<![CDATA[
<!-- user connects to service -->
<iq type='get'
from='service@clayster.com/service'
to='provisioning.clayster.com'
id='28'>
<canAccess xmlns='urn:xmpp:iot:provisioning' serviceToken='SERVICETOKEN1'>
2013-04-16 15:46:58 -04:00
<credentials type='IpAddress' value='10.0.0.1'/>
<credentials type='Longitude' value='123.45'/>
<credentials type='Latitude' value='67.89'/>
</canAccess>
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='service@clayster.com/service'
id='28'>
<canAccessResponse xmlns='urn:xmpp:iot:provisioning' userToken='USERTOKEN1' result='true'/>
2013-04-16 15:46:58 -04:00
</iq>
<!-- user performs login into service -->
<message from='service@clayster.com/service'
to='provisioning.clayster.com'>
<userLoggedIn xmlns='urn:xmpp:iot:provisioning' serviceToken='SERVICETOKEN1' userToken='USERTOKEN1' userName='Kermit' />
2013-04-16 15:46:58 -04:00
</message>
<iq type='get'
from='service@clayster.com/service'
to='provisioning.clayster.com'
id='29'>
<downloadPrivileges xmlns='urn:xmpp:iot:provisioning' serviceToken='SERVICETOKEN1' userToken='USERTOKEN1'/>
2013-04-16 15:46:58 -04:00
</iq>
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='service@clayster.com/service'
id='29'>
<downloadPrivilegesResponse>
2013-04-16 15:46:58 -04:00
<exclude id='Sensors.Delete'/>
<include id='Sensors'/>
</downloadPrivilegesResponse>
2013-04-16 15:46:58 -04:00
</iq>
<!-- user performs actions without interaction with the provisioning server -->]]>
</example>
<p>
<strong>Note:</strong> If the user or service has not been correctly identified, logged in, etc., the resulting list must only include privileges
that default users that are not logged in can have. This list can be empty.
</p>
2013-04-16 15:46:58 -04:00
</section3>
</section2>
</section1>
<section1 topic='Determining Support' anchor='support'>
<p>
If an entity is a Provisioning Server and supports the protocol specified herein, it MUST advertise that fact by returning a feature of "urn:xmpp:iot:provisioning"
in response to &xep0030; information requests.
</p>
<example caption="Service discovery information request">
2013-04-16 15:46:58 -04:00
<![CDATA[
<iq type='get'
from='device@clayster.com/device'
to='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
id='disco1'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>]]>
</example>
<example caption="Service discovery information response">
<![CDATA[
<iq type='result'
from='provisioning.clayster.com'
2013-04-16 15:46:58 -04:00
to='device@clayster.com/device'
id='disco1'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='urn:xmpp:iot:provisioning'/>
2013-04-16 15:46:58 -04:00
...
</query>
</iq>]]>
</example>
<p>
In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined
in &xep0115;. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.
</p>
</section1>
<section1 topic='Implementation Notes' anchor='impl'>
<section2 topic='JID vs Component Provisioning Servers' anchor='jidvscomponent'>
<p>
A client must treat the connection between a Provisioning Server differently if it is hosted as a client, having a JID, or if it is hosted as a Jabber Server Component.
If it is hosted as a server component, there's no need for the thing to become friends with the Provisioning Server. Messages and requests can be made directly to the
server component without having to add it to the roster or request presence subscriptions. If the Provisioning Server is hosted as a client, having a JID (@ in the address),
the Provisioning Server must be added to the roster of the client before the client can communicate with the Provisioning Server.
</p>
</section2>
<section2 topic='Caching and cache time' anchor='cache'>
2013-04-16 15:46:58 -04:00
<p>
To minimize network traffic, and optimize response time, devices should cache access rights and user privileges provided by the provisioning server. If memory is limited,
items in the cache should be ordered by last access, and items with the oldest last access timestamp should be removed first. A safety valve can optionally be implemented as well,
removing unused cache items after a certain age, even if memory is available.
</p>
<p>
The device can assume that access rights and user privileges on the provisioning server do not change over time, unless the provisioning server says so.
</p>
<p>
The provisioning server on the other hand, must keep track of when a device is online and offline, and clear the cache of the device if changes are made that affects the device.
If the device was offline when those changes occurred, the provisioning server must send the clear cache command as soon as the device comes online again.
</p>
<p>
When creating a new trust relationship, the device should always clear its cache, if it contains information from before.
</p>
<p>
To minimize stress of the provisioning server during synchronous sensor start up, for instance after a power failure, all clients should aim to persist its cache if possible. Clients
not persisting its cache may produce too much stress on the provisioning server on start-up, practically removing it from the network.
</p>
</section2>
<section2 topic='Working with multiple provisioning servers' anchor='multipleprovisioningservers'>
<p>
2013-04-16 15:46:58 -04:00
When working with multiple provisioning servers, there are some things that should be considered:
</p>
<ul>
<li>
When a device requests information from the provisioning servers, this can be done in a parallel fashion. Even though the provisioning servers
were added in a sequential fashion, there is no order or priority between the servers.
</li>
<li>
When receiving different responses from different servers, with regards to access rights, privileges, relationships, etc.,
the union of rights, or the most forgiving or most accepting response should be used. If one of the servers grant a privilege, the privilege is assumed
to exist. If one of the servers grant a friendship request, the friendship request should be granted, etc. Most probably, different servers will manage
different subsets of entities on the network, and when they receive questions about unrecognized devices, they will simply deny access.
</li>
<li>
If a provisioning server requires total control of the network, it should not allow secondary trust relationships. However, if such a server enters a network
and there exist previous provisioning servers (i.e. they accept secondary trust relationships), more trust relationships are assumed to be acceptable.
</li>
<li>
Even though examples in this document only list a secondary trust relationship, there is no such limit. There may exist many different trust relationships in a network
or for a given device.
</li>
</ul>
</section2>
<section2 topic='Automatic aggregation of services, users and privileges' anchor='aggregationservices'>
<p>
2013-04-16 15:46:58 -04:00
One important design consideration when implementing a provisioning server is how to handle new services, users and privileges. One option might be to automatically
ignore anything not recognized. Another option might be to dynamically add new services, user names and privileges to internal data sources, making it easier to manage
new types of services dynamically. However, adding such items automatically might also make such data sources grow beyond control.
</p>
</section2>
<section2 topic='Reading devices from large subsystems' anchor='largesubsystems'>
<p>
2013-04-16 15:46:58 -04:00
All examples in this document have been simplified examples where a few devices containing a few fields have been read. However, in many cases large subsystems with
very many sensors containing many fields have to be read, as is documented in <link url='http://xmpp.org/extensions/xep-0326.html'>Internet of Things - Concentrators</link>
<link url='http://xmpp.org/extensions/xep-0326.html'>Internet of Things - Concentrators</link>. In such cases, a node may have to be specified using two or perhaps
2013-04-16 15:46:58 -04:00
even three ID's: a <strong>sourceId</strong> identifying the data source controlling the device, a possible <strong>cacheType</strong> narrowing down the search to
a specific kind of node, and the common <strong>nodeId</strong>. For more information about this, see
<link url='http://xmpp.org/extensions/xep-0326.html'>Internet of Things - Concentrators</link>.
2013-04-16 15:46:58 -04:00
</p>
<p>
<strong>Note:</strong> For cases where the <strong>nodeId</strong> is sufficient to uniquely identify the node, it is sufficient to provide this attribute in the request.
If there is ambiguity in the request, the receptor must treat the request as a request with a set of nodes, all with the corresponding <strong>nodeId</strong> as requested.
</p>
</section2>
<section2 topic='Different types of tokens' anchor='tokentypes'>
<p>
2013-04-16 15:46:58 -04:00
A small note regarding the use of different tokens. A service can get a <strong>Service Token</strong>, a device a <strong>Device Token</strong> and a user
a <strong>User Token</strong>. When delegating these tokens to third parties, a service sends its <strong>Service Token</strong>. But, if the service does this
within the context of a user action, the service sends both its <strong>Service Token</strong> and the users <strong>User Token</strong>. The same with a device.
If a device delegates its token to a third party, it sends its <strong>Device Token</strong>. But if the device performs the action in the context of a user action,
the device sends both its <strong>Device Token</strong> as well as its <strong>User Token</strong>.
</p>
</section2>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<section2 topic='Trust Delegation' anchor='sectrustdelegation'>
<p>
Delegating trust to a third party may create a weak link in the overall security of a sensor network. Therefore, it's vitally important that the following be adhered to:
</p>
<ul>
<li>
Trust should only be delegated in a secure way. Once delegated, it should be able to lock this trust so it cannot be changed without reverting the device to
factory default settings. Such a locked delegation mode can be likened with a production mode, where vital configuration parameters should not be able to be changed.
</li>
<li>
If allowing installation using a LED, as above, make sure the LED does not light up for a long time, limiting the window of access where the sensor can be linked to a
provisioning server.
</li>
<li>
Provisioning servers should be monitored during operation, since it provides a vital link in the operation of the network.
</li>
<li>
Multiple provisioning servers could be allowed, for redundancy or for scalability. This specification does not limit the number of provisioning servers used in a network,
not used by a device. Examples in this specification use only one provisioning server for simplicity.
</li>
<li>
Generally, take care what kind of provisioning servers you allow in a network.
</li>
</ul>
</section2>
<section2 topic='Token Challenges' anchor='sectokenchallenges'>
<p>
When receiving token challenges from somebody, make sure you've sent the corresponding token to the corresponding party less than a minute before receiving the token
challenge. If not, the token challenge might represent a malicious attempt by somebody else to use the token to gain privileges in the network otherwise not enjoyed.
</p>
</section2>
</section1>
2013-04-16 15:46:58 -04:00
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<p>
The <link url="#schema">protocol schema</link> needs to be added to the list of <link url="http://xmpp.org/resources/schemas/">XMPP protocol schemas</link>.
</p>
</section1>
2013-04-16 15:46:58 -04:00
<section1 topic='XML Schema' anchor='schema'>
<code>
<![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:xmpp:iot:provisioning'
xmlns='urn:xmpp:iot:provisioning'
xmlns:sn='urn:xmpp:iot:sensordata'
2013-04-16 15:46:58 -04:00
elementFormDefault='qualified'>
<xs:import namespace='urn:xmpp:iot:sensordata'/>
2013-04-16 15:46:58 -04:00
<xs:element name='getToken' type='xs:base64Binary'/>
<xs:element name='getTokenChallenge' type='GetTokenChallengeResponse'/>
<xs:element name='getTokenChallengeResponse' type='GetTokenChallengeResponse'/>
2013-04-16 15:46:58 -04:00
<xs:element name='getTokenResponse' type='GetTokenResponse'/>
<xs:element name='tokenChallenge' type='TokenChallenge'/>
<xs:element name='tokenChallengeResponse' type='xs:base64Binary'/>
2013-04-16 15:46:58 -04:00
<xs:element name='isFriend' type='Friend'/>
<xs:element name='isFriendResponse' type='FriendResponse'/>
<xs:element name='unfriend' type='Friend'/>
<xs:element name='friend' type='Friend'/>
2013-04-16 15:46:58 -04:00
<xs:element name='canRead' type='CanRead'/>
<xs:element name='canReadResponse' type='CanReadResponse'/>
<xs:element name='canControl' type='CanControl'/>
<xs:element name='canControlResponse' type='CanControlResponse'/>
<xs:element name='clearCache'>
<xs:complexType/>
</xs:element>
<xs:element name='clearCacheResponse'>
<xs:complexType/>
</xs:element>
<xs:element name='canAccess'>
<xs:complexType>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element name='jid' type='JidCredential'/>
<xs:element name='ip4' type='Ip4Credential'/>
<xs:element name='ip6' type='Ip6Credential'/>
<xs:element name='hostName' type='HostNameCredential'/>
<xs:element name='x509Certificate' type='X509CertificateCredential'/>
<xs:element name='x509CertificateThumbprint' type='X509CertificateThumbprintCredential'/>
<xs:element name='userName' type='UserNameCredential'/>
<xs:element name='longitude' type='LongitudeCredential'/>
<xs:element name='latitude' type='LatitudeCredential'/>
<xs:element name='altitude' type='AltitudeCredential'/>
<xs:element name='sso' type='SsoCredential'/>
<xs:element name='protocol' type='ProtocolCredential'/>
</xs:choice>
<xs:attribute name='serviceToken' type='xs:string' use='required'/>
</xs:complexType>
</xs:element>
<xs:element name='canAccessResponse'>
<xs:complexType>
<xs:attribute name='result' type='xs:boolean' use='required'/>
<xs:attribute name='userToken' type='xs:string' use='optional'/>
</xs:complexType>
</xs:element>
<xs:element name='userLoggedIn'>
<xs:complexType>
<xs:attribute name='serviceToken' type='xs:string' use='required'/>
<xs:attribute name='userToken' type='xs:string' use='required'/>
<xs:attribute name='userName' type='xs:string' use='required'/>
</xs:complexType>
</xs:element>
<xs:element name='hasPrivilege'>
<xs:complexType>
<xs:attribute name='serviceToken' type='xs:string' use='required'/>
<xs:attribute name='userToken' type='xs:string' use='required'/>
<xs:attribute name='privilegeId' type='PrivilegeId' use='required'/>
</xs:complexType>
</xs:element>
<xs:element name='hasPrivilegeResponse'>
<xs:complexType>
<xs:attribute name='result' type='xs:boolean' use='required'/>
</xs:complexType>
</xs:element>
<xs:element name='downloadPrivileges'>
<xs:complexType>
<xs:attribute name='serviceToken' type='xs:string' use='required'/>
<xs:attribute name='userToken' type='xs:string' use='required'/>
</xs:complexType>
</xs:element>
<xs:element name='downloadPrivilegesResponse'>
<xs:complexType>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element name='include' type='Privilege'/>
<xs:element name='exclude' type='Privilege'/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:complexType name='GetTokenResponse'>
<xs:attribute name='token' type='xs:string' use='required'/>
</xs:complexType>
<xs:complexType name='GetTokenChallengeResponse'>
<xs:simpleContent>
<xs:extension base='xs:base64Binary'>
<xs:attribute name='seqnr' type='xs:int' use='required'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name='TokenChallenge'>
<xs:simpleContent>
<xs:extension base='xs:base64Binary'>
<xs:attribute name='token' type='xs:string' use='required'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
2013-04-16 15:46:58 -04:00
<xs:complexType name='Friend'>
<xs:attribute name='jid' type='xs:string' use='required'/>
</xs:complexType>
<xs:complexType name='FriendResponse'>
<xs:complexContent>
<xs:extension base='Friend'>
<xs:attribute name='result' type='xs:boolean' use='required'/>
<xs:attribute name='secondaryTrustAllowed' type='xs:boolean' use='optional' default='false'/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name='CanReadBase' abstract='true'>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element name='node'>
<xs:complexType>
<xs:attribute name='nodeId' type='xs:string' use='required'/>
<xs:attribute name='sourceId' type='xs:string' use='optional'/>
<xs:attribute name='cacheType' type='xs:string' use='optional'/>
</xs:complexType>
</xs:element>
<xs:element name='field'>
<xs:complexType>
<xs:attribute name='name' type='xs:string' use='required'/>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:attributeGroup ref='sn:fieldTypes'/>
<xs:attribute name='all' type='xs:boolean' use='optional' default='false'/>
<xs:attribute name='historical' type='xs:boolean' use='optional' default='false'/>
<xs:attribute name='jid' type='xs:string' use='required'/>
</xs:complexType>
<xs:complexType name='CanRead'>
<xs:complexContent>
<xs:extension base='CanReadBase'>
<xs:attributeGroup ref='tokens'/>
2013-04-16 15:46:58 -04:00
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:attributeGroup name='tokens'>
<xs:attribute name='serviceToken' type='xs:string' use='optional'/>
<xs:attribute name='userToken' type='xs:string' use='optional'/>
<xs:attribute name='deviceToken' type='xs:string' use='optional'/>
</xs:attributeGroup>
2013-04-16 15:46:58 -04:00
<xs:complexType name='CanReadResponse'>
<xs:complexContent>
<xs:extension base='CanReadBase'>
<xs:attribute name='result' type='xs:boolean' use='required'/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name='CanControlBase' abstract='true'>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element name='node'>
<xs:complexType>
<xs:attribute name='nodeId' type='xs:string' use='required'/>
<xs:attribute name='sourceId' type='xs:string' use='optional'/>
<xs:attribute name='cacheType' type='xs:string' use='optional'/>
</xs:complexType>
</xs:element>
<xs:element name='parameter'>
<xs:complexType>
<xs:attribute name='name' type='xs:string' use='required'/>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:attribute name='jid' type='xs:string' use='required'/>
</xs:complexType>
<xs:complexType name='CanControl'>
<xs:complexContent>
<xs:extension base='CanControlBase'>
<xs:attributeGroup ref='tokens'/>
2013-04-16 15:46:58 -04:00
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name='CanControlResponse'>
<xs:complexContent>
<xs:extension base='CanControlBase'>
<xs:attribute name='result' type='xs:boolean' use='required'/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name='JidCredential'>
<xs:attribute name='value' type='xs:string' use='required'/>
</xs:complexType>
<xs:complexType name='Ip4Credential'>
<xs:attribute name='value' type='xs:string' use='required'/>
</xs:complexType>
<xs:complexType name='Ip6Credential'>
<xs:attribute name='value' type='xs:string' use='required'/>
</xs:complexType>
<xs:complexType name='HostNameCredential'>
<xs:attribute name='value' type='xs:string' use='required'/>
</xs:complexType>
<xs:complexType name='X509CertificateCredential'>
<xs:attribute name='base64' type='xs:string' use='required'/>
</xs:complexType>
<xs:complexType name='X509CertificateThumbprintCredential'>
<xs:attribute name='base64' type='xs:string' use='required'/>
</xs:complexType>
<xs:complexType name='UserNameCredential'>
<xs:attribute name='value' type='xs:string' use='required'/>
</xs:complexType>
<xs:complexType name='LongitudeCredential'>
<xs:attribute name='value' type='xs:double' use='required'/>
</xs:complexType>
<xs:complexType name='LatitudeCredential'>
<xs:attribute name='value' type='xs:double' use='required'/>
</xs:complexType>
<xs:complexType name='AltitudeCredential'>
<xs:attribute name='value' type='xs:double' use='required'/>
</xs:complexType>
<xs:complexType name='SsoCredential'>
<xs:attribute name='value' type='xs:string' use='required'/>
</xs:complexType>
<xs:complexType name='ProtocolCredential'>
<xs:attribute name='value' type='ProtocolName' use='required'/>
</xs:complexType>
<xs:complexType name='Privilege'>
<xs:attribute name='id' type='PrivilegeId' use='required'/>
</xs:complexType>
<xs:simpleType name='ProtocolName'>
<xs:restriction base='xs:string'>
<xs:enumeration value='XMPP'/>
<xs:enumeration value='HTTP'/>
<xs:enumeration value='HTTPS'/>
<xs:enumeration value='TcpSocket'/>
<xs:enumeration value='UdpSocket'/>
<xs:enumeration value='Queue'/>
<xs:enumeration value='Internal'/>
<xs:enumeration value='Other'/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name='PrivilegeId'>
<xs:restriction base='xs:string'>
<xs:pattern value='^[^.]+([.][^.]+)*$'/>
</xs:restriction>
</xs:simpleType>
</xs:schema>]]>
</code>
</section1>
<section1 topic='For more information' anchor='moreinfo'>
<p>
For more information, please see the following resources:
</p>
<ul>
<li>
<p>
The <link url='http://wiki.xmpp.org/web/Tech_pages/SensorNetworks'>Sensor Network section of the XMPP Wiki</link> contains further information about the
use of the sensor network XEPs, links to implementations, discussions, etc.
</p>
</li>
<li>
<p>
The XEP's and related projects are also available on <link url='https://github.com/joachimlindborg/'>github</link>, thanks to Joachim Lindborg.
</p>
</li>
<li>
<p>
A presentation giving an overview of all extensions related to Internet of Things can be found here:
<link url='http://prezi.com/esosntqhewhs/iot-xmpp/'>http://prezi.com/esosntqhewhs/iot-xmpp/</link>.
</p>
</li>
</ul>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
<p>Thanks to Joachim Lindborg, Karin Forsell, Tina Beckman and Teemu Väisänen for all valuable feedback.</p>
</section1>
2013-04-16 16:07:31 -04:00
</xep>