1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-24 18:22:24 -05:00
xeps/xep-0078.xml
Peter Saint-Andre a498e49806 corrected examples
git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@3966 4b5297f7-1745-476d-ba37-a9c6900126ab
2010-02-22 04:23:33 +00:00

374 lines
21 KiB
XML

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Non-SASL Authentication</title>
<abstract>This document specifies a protocol for authentication with Jabber servers and services using the jabber:iq:auth namespace. Note Well: The protocol specified herein has been superseded in favor of SASL authentication as specified in RFC 3920, and is now obsolete.</abstract>
&LEGALNOTICE;
<number>0078</number>
<status>Obsolete</status>
<type>Standards Track</type>
<sig>Standards</sig>
<dependencies>
<spec>XMPP Core</spec>
<spec>RFC 3174</spec>
</dependencies>
<supersedes/>
<supersededby>
<spec>RFC 3920</spec>
</supersededby>
<shortname>iq-auth</shortname>
<schemaloc>
<url>http://www.xmpp.org/schemas/iq-auth.xsd</url>
</schemaloc>
&stpeter;
<revision>
<version>2.5</version>
<date>2008-10-29</date>
<initials>psa</initials>
<remark><p>Per a vote of the XMPP Council, changed status to Obsolete.</p></remark>
</revision>
<revision>
<version>2.4</version>
<date>2008-01-30</date>
<initials>psa</initials>
<remark><p>Clarified the reasoning behind adoption of SASL and corrected the security considerations accordingly.</p></remark>
</revision>
<revision>
<version>2.3</version>
<date>2006-09-13</date>
<initials>psa</initials>
<remark><p>Per a vote of the Jabber Council, changed status to Deprecated.</p></remark>
</revision>
<revision>
<version>2.2</version>
<date>2005-06-28</date>
<initials>psa</initials>
<remark><p>Corrected error in schema and example (username is not required in IQ-get).</p></remark>
</revision>
<revision>
<version>2.1</version>
<date>2004-12-09</date>
<initials>psa</initials>
<remark><p>Changed SHOULD to MUST regarding priority of SASL (RFC 3920) over jabber:iq:auth (XEP-0078).</p></remark>
</revision>
<revision>
<version>2.0</version>
<date>2004-10-20</date>
<initials>psa</initials>
<remark><p>Per a vote of the Jabber Council, advanced status to Final.</p></remark>
</revision>
<revision>
<version>1.8</version>
<date>2004-10-18</date>
<initials>psa</initials>
<remark><p>Specified advertising iq-auth stream feature is implementation-specific; clarified several small matters in the text.</p></remark>
</revision>
<revision>
<version>1.7</version>
<date>2004-07-27</date>
<initials>psa</initials>
<remark><p>Added reference to character escaping in digest authentication; required inclusion of stream feature when server supports stream features and it is safe to advertise non-SASL authentication.</p></remark>
</revision>
<revision>
<version>1.6</version>
<date>2004-07-21</date>
<initials>psa</initials>
<remark><p>Removed reference to UTF-16, which is disallowed by XMPP Core; removed reference to character escaping in digest authentication pending list discussion.</p></remark>
</revision>
<revision>
<version>1.5</version>
<date>2004-02-18</date>
<initials>psa</initials>
<remark><p>Added optional stream feature.</p></remark>
</revision>
<revision>
<version>1.4</version>
<date>2004-02-03</date>
<initials>psa</initials>
<remark><p>Clarified that username and resource are required for authentication.</p></remark>
</revision>
<revision>
<version>1.3</version>
<date>2003-11-26</date>
<initials>psa</initials>
<remark><p>Added XMPP error handling.</p></remark>
</revision>
<revision>
<version>1.2</version>
<date>2003-11-06</date>
<initials>psa</initials>
<remark><p>Addressed case of attempting jabber:iq:auth after SASL failure.</p></remark>
</revision>
<revision>
<version>1.1</version>
<date>2003-10-02</date>
<initials>psa</initials>
<remark><p>Moved change password use case to XEP-0077.</p></remark>
</revision>
<revision>
<version>1.0</version>
<date>2003-06-18</date>
<initials>psa</initials>
<remark><p>Per a vote of the Jabber Council, advanced status to Draft.</p></remark>
</revision>
<revision>
<version>0.8</version>
<date>2003-06-18</date>
<initials>psa</initials>
<remark><p>Changes to address Council concerns.</p></remark>
</revision>
<revision>
<version>0.7</version>
<date>2003-06-13</date>
<initials>psa</initials>
<remark><p>Added change password use case; added more details to security considerations.</p></remark>
</revision>
<revision>
<version>0.6</version>
<date>2003-06-12</date>
<initials>psa</initials>
<remark><p>Added digest example; clarified escaping requirements; further specified error conditions; added more details to security considerations.</p></remark>
</revision>
<revision>
<version>0.5</version>
<date>2003-06-06</date>
<initials>psa</initials>
<remark><p>Removed XMPP-style error conditions until formats are stable.</p></remark>
</revision>
<revision>
<version>0.4</version>
<date>2003-05-30</date>
<initials>psa</initials>
<remark><p>Removed "enhanced digest" content, added information about expiration date.</p></remark>
</revision>
<revision>
<version>0.3</version>
<date>2003-05-28</date>
<initials>psa</initials>
<remark><p>Added "enhanced digest" method.</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2003-05-20</date>
<initials>psa</initials>
<remark><p>Slight editorial revisions.</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2003-04-10</date>
<initials>psa</initials>
<remark><p>Initial version.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p><em>Note Well: The protocol specified herein has been superseded in favor of SASL authentication as specified in &rfc3920;, and is now obsolete.</em></p>
<p>Jabber technologies have long included a wire protocol that enables a client to authenticate with a server. <note>Component authentication is out of scope for this document, and is specified separately in &xep0114;.</note> The method originally used in the Jabber community makes use of the 'jabber:iq:auth' namespace and has been documented variously in Internet-Drafts and elsewhere. When the core Jabber protocols were formalized by the IETF, the 'jabber:iq:auth' protocol was replaced by the Simple Authentication and Security Layer (SASL) as specified in &rfc4422;. SASL was incorporated into XMPP because it provides a more flexible approach to authentication by enabling XMPP entities to use a wide variety of authentication methods (e.g., PLAIN, DIGEST-MD5, EXTERNAL, and ANONYMOUS), some of which are more secure than the 'jabber:iq:auth' protocol.</p>
<p>The 'jabber:iq:auth' protocol specified herein is now obsolete. However, because it will take some time for existing implementations and deployments to be upgraded to SASL, client and server software implementations still need to include support for 'jabber:iq:auth' in order to interoperate, and this document provides canonical documentation of the 'jabber:iq:auth' protocol. Nevertheless, implementation and deployment of SASL authentication is strongly recommended, since the 'jabber:iq:auth' protocol will eventually be obsoleted entirely.</p>
</section1>
<section1 topic='Requirements' anchor='reqs'>
<p>The 'jabber:iq:auth' namespace must make it possible for a Jabber client to authenticate with a server. In particular, the client must provide a username and appropriate credentials for the specific authentication method used. The methods defined herein are:</p>
<ol>
<li>plaintext</li>
<li>digest (using the SHA1 algorithm specified in &rfc3174;)</li>
</ol>
<p>Note: This document does not include the so-called "zero-knowledge" method; that method did not provide stronger security than digest authentication and thus is unnecessary.</p>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
<section2 topic='User Authenticates with Server' anchor='usecases-auth'>
<p>In order to determine which fields are required for authentication with a server, a client SHOULD first send an IQ get to the server. A client SHOULD NOT attempt to guess at the required fields, since the nature of the required data is subject to service provisioning.</p>
<example caption='Client Requests Authentication Fields from Server'><![CDATA[
<iq type='get' to='shakespeare.lit' id='auth1'>
<query xmlns='jabber:iq:auth'/>
</iq>
]]></example>
<example caption='Server Returns Authentication Fields to Client'><![CDATA[
<iq type='result' id='auth1'>
<query xmlns='jabber:iq:auth'>
<username/>
<password/>
<digest/>
<resource/>
</query>
</iq>
]]></example>
<p>If the client included a username with the IQ-get but there is no such username, the server SHOULD NOT return an error, but instead SHOULD return the normal authentication fields (this helps to prevent unknown users from discovering which usernames are in use). If the server does not support non-SASL authentication (e.g., because it supports only SASL authentication as defined in <cite>RFC 3920</cite>), it MUST return a &unavailable; error. If the client previously attempted SASL authentication but that attempt failed, the server MUST return a &lt;policy-violation/&gt; stream error (see <cite>RFC 3920</cite> regarding stream error syntax).</p>
<p>Both the username and the resource are REQUIRED for client authentication using the 'jabber:iq:auth' namespace; if more flexible authentication and resource provisioning are desired, a server SHOULD implement SASL authentication and resource binding as defined in <cite>RFC 3920</cite> (e.g., to enable the server to provide the resource). The &lt;username/&gt; and &lt;resource/&gt; elements MUST be included in the IQ result returned by the server in response to the initial IQ get, and also MUST be included in the IQ set sent by the client when providing authentication credentials.</p>
<p>The foregoing stanza shows that the server supports both plaintext authentication (via the &lt;password/&gt; element) and digest authentication with SHA1-encrypted passwords (via the &lt;digest/&gt; element).</p>
<p>Therefore, in order to successfully authenticate with the server in this example, a client MUST provide a username, a resource, and one of password or digest.</p>
<example caption='Client Provides Required Information (Plaintext)'><![CDATA[
<iq type='set' id='auth2'>
<query xmlns='jabber:iq:auth'>
<username>bill</username>
<password>Calli0pe</password>
<resource>globe</resource>
</query>
</iq>
]]></example>
<p>Plaintext passwords are straightforward (obviously, characters that map to predefined XML entities MUST be escaped according to the rules defined in section 4.6 of the XML specification, and any non-US-ASCII characters MUST be encoded according to the encoding of XML streams as specified in <cite>RFC 3920</cite>, i.e., UTF-8 as defined in &rfc3269;).</p>
<p>The value of the &lt;digest/&gt; element MUST be computed according to the following algorithm:</p>
<ol>
<li>Concatenate the Stream ID received from the server with the password. <note>In Digest authentication, password characters that map to predefined XML entities SHOULD NOT be escaped as they are for plaintext passwords, but non-US-ASCII characters MUST be encoded as UTF-8 since the SHA-1 hashing algorithm operates on byte arrays.</note></li>
<li>Hash the concatenated string according to the SHA1 algorithm, i.e., SHA1(concat(sid, password)).</li>
<li>Ensure that the hash output is in hexidecimal format, not binary or base64.</li>
<li>Convert the hash output to all lowercase characters.</li>
</ol>
<example caption='Client Provides Required Information (Digest)'><![CDATA[
<iq type='set' id='auth2'>
<query xmlns='jabber:iq:auth'>
<username>bill</username>
<digest>48fc78be9ec8f86d8ce1c39c320c97c21d62334d</digest>
<resource>globe</resource>
</query>
</iq>
]]></example>
<p>The character data shown in the &lt;digest/&gt; element is the output produced as a result of following the algorithm defined above when the stream ID is '3EE948B0' and the password is 'Calli0pe'.</p>
<p>If the credentials provided match those known by the server, the client will be successfully authenticated.</p>
<example caption='Server Informs Client of Successful Authentication'><![CDATA[
<iq type='result' id='auth2'/>
]]></example>
<p>Alternatively, authentication may fail. Possible causes of failure include:</p>
<ol>
<li>The user provided incorrect credentials.</li>
<li>There is a resource conflict (i.e., there is already an active session with that resource identifier associated with the same username). The RECOMMENDED behavior is for the server to terminate the existing session and create the new one; however, the server MAY provide the opposite behavior if desired, leading to a conflict error for the newly requested login.</li>
<li>The user did not provide all of the required information (e.g., did not provide a username or resource).</li>
</ol>
<p>Although <cite>RFC 3920</cite> specifies that error stanzas SHOULD include the original XML sent, error stanzas qualified by the 'jabber:iq:auth' namespace SHOULD NOT do so given the sensitive nature of the information being exchanged.</p>
<example caption='Server Informs Client of Failed Authentication (Incorrect Credentials)'><![CDATA[
<iq type='error' id='auth2'>
<error code='401' type='auth'>
<not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
]]></example>
<example caption='Server Informs Client of Failed Authentication (Resource Conflict)'><![CDATA[
<iq type='error' id='auth2'>
<error code='409' type='cancel'>
<conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
]]></example>
<example caption='Server Informs Client of Failed Authentication (Required Information Not Provided)'><![CDATA[
<iq type='error' id='auth2'>
<error code='406' type='modify'>
<not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
]]></example>
</section2>
</section1>
<section1 topic='Stream Feature' anchor='streamfeature'>
<p><cite>RFC 3920</cite> defines methods for advertising feature support during stream negotiation. It may be desirable for a server to advertise support for non-SASL authentication as a stream feature. The namespace for reporting support within &lt;stream:features/&gt; is "http://jabber.org/features/iq-auth". Upon receiving a stream header qualified by the 'jabber:client' namespace, a server that returns stream features SHOULD also announce support for non-SASL authentication by including the relevant stream feature. Exactly when a server advertises the iq-auth stream feature is up to the implementation or deployment (e.g., a server MAY advertise this feature only after successful TLS negotiation or if the channel is encrypted via the older SSL method). Obviously, this does not apply to servers that do not support stream features (e.g., older servers that do not comply with XMPP 1.0).</p>
<example caption='Advertising non-SASL authentication as a stream feature'><![CDATA[
<stream:features>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>DIGEST-MD5</mechanism>
<mechanism>PLAIN</mechanism>
</mechanisms>
<auth xmlns='http://jabber.org/features/iq-auth'/>
</stream:features>
]]></example>
<p>A server SHOULD NOT advertise non-SASL authentication to another server (i.e., if the initial stream header was qualified by the 'jabber:server' namespace).</p>
</section1>
<section1 topic='Error Handling' anchor='errors'>
<p>As defined herein, the 'jabber:iq:auth' namespace supports both the old (HTTP-style) error codes and the extensible error classes and conditions specified in <cite>RFC 3920</cite>. A compliant server or service implementation MUST support both old-style and new-style error handling. A compliant client implementation SHOULD support both.</p>
</section1>
<section1 topic='Expiration Date' anchor='expiration'>
<p>In accordance with Section 8 of &xep0001;, on 2004-10-20 this document was advanced to a status of Final with the understanding that it would expire in six months. On 2006-09-13, the Jabber Council (now XMPP Council) changed the status of this document to Deprecated. The Jabber Council will review this document every six months to determine whether to change its status to Obsolete or to extend the expiration date for an additional six months; this process will continue until the document is obsoleted. For the latest expiration date, refer to the XEP Information block at the beginning of this document.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>Use of SASL authentication can be more secure than the 'jabber:iq:auth' protocol, depending on which SASL mechanism is used. Because SASL provides greater flexibility and can provide stronger security, the 'jabber:iq:auth' protocol is now obsolete. If both client and server implement SASL, they MUST prefer SASL over the 'jabber:iq:auth' protocol. If a client attempts to authenticate using the 'jabber:iq:auth' namespace after an attempt at SASL authentication fails, the server MUST refuse the 'jabber:iq:auth' attempt by returning a &lt;policy-violation/&gt; stream error to the client.</p>
<p>Client implementations MUST NOT make plaintext the default mechanism, and SHOULD warn the user that the plaintext mechanism is insecure. The plaintext mechanism SHOULD NOT be used unless the underlying stream is encrypted (using SSL or TLS) and the client has verified that the server certificate is signed by a trusted certification authority. A given domain MAY choose to disable plaintext logins if the stream is not properly encrypted, or disable them entirely. If a client implements the plaintext mechanism and a server allows both the digest mechanism and the plaintext mechanism when channel encryption is not in use, a downgrade attack is possible, in which a man-in-the-middle tricks the client into revealing the user's plaintext password.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Protocol Namespaces' anchor='registrar-ns'>
<p>The &REGISTRAR; includes the 'jabber:iq:auth' namespace in its registry of protocol namespaces.</p>
</section2>
<section2 topic='Stream Features' anchor='registrar-stream'>
<p>The XMPP Registrar includes the 'http://jabber.org/features/iq-auth' namespace in its registry of stream feature namespaces.</p>
</section2>
</section1>
<section1 topic='XML Schemas' anchor='schemas'>
<section2 topic='jabber:iq:auth' anchor='schemas-auth'>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='jabber:iq:auth'
xmlns='jabber:iq:auth'
elementFormDefault='qualified'>
<xs:annotation>
<xs:documentation>
NOTE WELL: Non-SASL Authentication via the jabber:iq:auth
protocol has been superseded by SASL Authentication as
defined in RFC 3920, and is now obsolete.
For historical purposes, the protocol documented by this
schema is defined in XEP-0078:
http://www.xmpp.org/extensions/xep-0078.html
</xs:documentation>
</xs:annotation>
<xs:element name='query'>
<xs:complexType>
<xs:sequence>
<xs:element name='username' type='xs:string' minOccurs='0'/>
<xs:choice>
<xs:element name='password' type='xs:string' minOccurs='0'/>
<xs:element name='digest' type='xs:string' minOccurs='0'/>
</xs:choice>
<xs:element name='resource' type='xs:string' minOccurs='0'/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
]]></code>
</section2>
<section2 topic='Stream Feature' anchor='schemas-stream'>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='http://jabber.org/features/iq-auth'
xmlns='http://jabber.org/features/iq-auth'
elementFormDefault='qualified'>
<xs:annotation>
<xs:documentation>
NOTE WELL: Non-SASL Authentication via the jabber:iq:auth
protocol has been superseded by SASL Authentication as
defined in RFC 3920, and is now obsolete.
For historical purposes, the protocol documented by this
schema is defined in XEP-0078:
http://www.xmpp.org/extensions/xep-0078.html
</xs:documentation>
</xs:annotation>
<xs:element name='auth' type='empty'/>
<xs:simpleType name='empty'>
<xs:restriction base='xs:string'>
<xs:enumeration value=''/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
]]></code>
</section2>
</section1>
</xep>