Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XEP-0388: Fix the XML Schema and examples #1369

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
271 changes: 145 additions & 126 deletions xep-0388.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
&dcridland;
&tmolitor;
&mwild;
<revision>
<version>1.0.2</version>
<date>2024-08-06</date>
<initials>egp</initials>
<remark><ul>
<li>Fix various invalid examples.</li>
<li>Fix the XML Schema to match examples.</li>
</ul></remark>
</revision>
<revision>
<version>1.0.1</version>
<date>2024-04-04</date>
Expand Down Expand Up @@ -91,12 +100,12 @@
<remark>
<p>Updated according to implementation experience:</p>
<ul>
<li>Updated namespace</li>
<li>Continue "mechanisms" are not; changed these to "tasks".</li>
<li>Added stream features after Success.</li>
<li>Don't need complexity of "=" encoding; removed.</li>
<li>Fixed internal links.</li>
<li>Updated examples.</li>
<li>Updated namespace</li>
<li>Continue "mechanisms" are not; changed these to "tasks".</li>
<li>Added stream features after Success.</li>
<li>Don't need complexity of "=" encoding; removed.</li>
<li>Fixed internal links.</li>
<li>Updated examples.</li>
</ul>
</remark>
</revision>
Expand Down Expand Up @@ -174,7 +183,7 @@
<!-- Server indicates that XEP-0198 stream resumption can be done "inline" -->
<sm xmlns='urn:xmpp:sm:3'/>
<!-- Server indicates support for XEP-0386 Bind 2 -->
<bind xmlns='urn:xmpp:bind2:1'/>
<bind xmlns='urn:xmpp:bind:0'/>
</inline>
</authentication>
<!-- Channel-binding information provided by XEP-0440 -->
Expand Down Expand Up @@ -512,7 +521,7 @@
<!--
And the client responds:
-->
<response xmlns='urn:xmpp:sasl:2>
<response xmlns='urn:xmpp:sasl:2'>
dGltIGI5MTNhNjAyYzdlZGE3YTQ5NWI0ZTZlNzMzNGQzODkw
</response>

Expand Down Expand Up @@ -591,7 +600,7 @@
<!--
And the client responds:
-->
<response xmlns='urn:xmpp:sasl:2>
<response xmlns='urn:xmpp:sasl:2'>
dGltIGI5MTNhNjAyYzdlZGE3YTQ5NWI0ZTZlNzMzNGQzODkw
</response>

Expand Down Expand Up @@ -628,16 +637,16 @@
<question xmlns='urn:example:unrealistic2fa'>
PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2UucmVzdG9uLm1jaS5uZXQ+
</question>
</task>
</task-data>

<!--
The client responds here.
-->
<task-data xmlns='urn:xmpp:sasl:2'>
<response xmlns='urn:example:unrealistic2fa'>
dGltIGI5MTNhNjAyYzdlZGE3YTQ5NWI0ZTZlNzMzNGQzODkw
</respons>
</task>
</response>
</task-data>

<!--
Finally, the server sends a success.
Expand Down Expand Up @@ -686,131 +695,141 @@
<section1 topic="XML Schema">
<code><![CDATA[
<?xml version='1.0' encoding='utf-8'?>

<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace="urn:xmpp:sasl:2"
xmlns="urn:xmpp:sasl:2"
elementFormDefault="qualified">

<xs:element name="authentication">
<xs:complexType>
<xs:sequence>
<xs:element name="mechanism" type="SaslMechName" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="inline" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:any/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="abort">
<xs:complexType>
<xs:annotation>
<xs:documentation>
The protocol documented by this schema is defined in
XEP-0388: http://xmpp.org/extensions/xep-0388.html
</xs:documentation>
</xs:annotation>

<xs:element name="authentication">
<xs:complexType>
<xs:sequence>
<xs:element name="mechanism" type="SaslMechName" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="inline" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="text" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:any/>
<xs:any namespace='##other' maxOccurs='unbounded' processContents='lax'/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="authenticate">
<xs:complexType>
<xs:attribute name="mechanism" type="SaslMechName"/>
<xs:sequence>
<xs:element name="initial-response" type="SaslData" minOccurs="0" maxOccurs="1"/>
<xs:element name="user-agent>
<xs:complexType>
<xs:attribute name="id" type="Uuid"/>
<xs:sequence>
<xs:element name="software" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="device" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:any/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="challenge" type="SaslData"/>

<xs:element name="response" type="SaslData"/>

<xs:element name="success">
<xs:complexType>
<xs:sequence>
<xs:element name="additional-data" type="SaslData" minOccurs="0" maxOccurs="1"/>
<xs:element name="authorization-identifier" type="Jid" minOccurs="1" maxOccurs="1"/>
<xs:any/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="failure">
<xs:complexType>
<xs:sequence>
<xs:element name="text" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:any/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="continue">
<xs:complexType>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="abort">
<xs:complexType>
<xs:sequence>
<xs:element name="text" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded' processContents='lax'/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="authenticate">
<xs:complexType>
<xs:sequence>
<xs:element name="initial-response" type="SaslData" minOccurs="0" maxOccurs="1"/>
<xs:element name="user-agent">
<xs:complexType>
<xs:sequence>
<xs:element name="additional-data" type="SaslData"/>
<xs:element name="tasks">
<xs:complexType>
<xs:sequence>
<xs:element name="tasK" type="SaslMechName"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="software" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="device" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="next">
<xs:complexType>
<xs:attribute name="task" type="SaslMechName"/>
<xs:sequence>
<xs:any/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="task-data">
<xs:complexType>
<xs:attribute name="id" type="Uuid"/>
</xs:complexType>
</xs:element>
<xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded' processContents='lax'/>
</xs:sequence>
<xs:attribute name="mechanism" type="SaslMechName"/>
</xs:complexType>
</xs:element>

<xs:element name="challenge" type="SaslData"/>

<xs:element name="response" type="SaslData"/>

<xs:element name="success">
<xs:complexType>
<xs:sequence>
<xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded' processContents='lax'/>
<xs:element name="additional-data" type="SaslData" minOccurs="0"/>
<xs:element name="authorization-identifier" type="Jid"/>
<xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded' processContents='lax'/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="failure">
<xs:complexType>
<xs:sequence>
<xs:element name="text" type="xs:string" minOccurs="0"/>
<xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded' processContents='lax'/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="continue">
<xs:complexType>
<xs:sequence>
<xs:element name="additional-data" type="SaslData"/>
<xs:element name="tasks">
<xs:complexType>
<xs:sequence>
<xs:any/>
<xs:element name="task" type="SaslMechName" maxOccurs='unbounded'/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:simpleType name="Jid">
<xs:restriction base="xs:string">
<xs:maxLength value="3071"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="Uuid">
<xsd:restriction base="xsd:string">
<xsd:pattern value="([0-9]|[a-f]|[A-F]){8}-([0-9]|[a-f]|[A-F]){4}-([0-9]|[a-f]|[A-F]){4}-([0-9]|[a-f]|[A-F]){4}-([0-9]|[a-f]|[A-F]){12}"/>
</xsd:restriction>
</xs:simpleType>

<xs:simpleType name="SaslMechName">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="SaslData">
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>
</xs:complexType>
</xs:element>
<xs:element name="text" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="next">
<xs:complexType>
<xs:sequence>
<xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded' processContents='lax'/>
</xs:sequence>
<xs:attribute name="task" type="SaslMechName"/>
</xs:complexType>
</xs:element>

<xs:element name="task-data">
<xs:complexType>
<xs:sequence>
<xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded' processContents='lax'/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:simpleType name="Jid">
<xs:restriction base="xs:string">
<xs:maxLength value="3071"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="Uuid">
<xs:restriction base="xs:string">
<xs:pattern value="([0-9]|[a-f]|[A-F]){8}-([0-9]|[a-f]|[A-F]){4}-([0-9]|[a-f]|[A-F]){4}-([0-9]|[a-f]|[A-F]){4}-([0-9]|[a-f]|[A-F]){12}"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a historical reason that ([0-9]|[a-f]|[A-F]){8} isn't written as ([0-9a-fA-F]){8} ?
Maybe compatibility with certain tools?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably just copy/pasted it from somewhere else, feel free to PR that change as it makes it slightly more readable. :)

</xs:restriction>
</xs:simpleType>

<xs:simpleType name="SaslMechName">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="SaslData">
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>
</xs:schema>
]]></code>
</section1>
Expand Down