<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.2.8 -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<?rfc toc="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>

<rfc ipr="trust200902" docName="draft-ietf-capport-api-00" category="std">

  <front>
    <title abbrev="Captive Portal API">Captive Portal API</title>

    <author initials="T." surname="Pauly" fullname="Tommy Pauly" role="editor">
      <organization>Apple Inc.</organization>
      <address>
        <postal>
          <street>1 Infinite Loop</street>
          <city>Cupertino, California 95014</city>
          <country>United States of America</country>
        </postal>
        <email>tpauly@apple.com</email>
      </address>
    </author>
    <author initials="D." surname="Thakore" fullname="Darshak Thakore" role="editor">
      <organization>CableLabs</organization>
      <address>
        <postal>
          <street>858 Coal Creek Circle</street>
          <city>Louisville, CO 80027</city>
          <country>United States of America</country>
        </postal>
        <email>d.thakore@cablelabs.com</email>
      </address>
    </author>

    <date year="2018" month="February" day="03"/>

    
    
    <keyword>Internet-Draft</keyword>

    <abstract>


<t>This document describes an HTTP API that allows hosts to interact with a Captive Portal system.</t>



    </abstract>


  </front>

  <middle>


<section anchor="introduction" title="Introduction">

<t>This document describes a HyperText Transfer Protocol (HTTP) Application Program Interface (API) that allows hosts to interact with a Captive Portal system. The API defined in this document has been designed to meet the requirements in the Captive Portal Architecture <xref target="I-D.ietf-capport-architecture"></xref>. Specifically, the API provides:</t>

<t><list style="symbols">
  <t>The state of captivity (whether or not the host has access to the Internet)</t>
  <t>A URI that a host’s browser can present to a user to get out of captivity</t>
  <t>An encrypted connection (TLS for both the API and portal URI)</t>
</list></t>

</section>
<section anchor="workflow" title="Workflow">

<t>The Captive Portal Architecture defines three steps of interaction between hosts and a Captive Portal service:</t>

<t><list style="numbers">
  <t>Provisioning, in which a host discovers that a network has a captive portal, and learns the URI of the API server</t>
  <t>API Server interaction, in which a host queries the state of the captive portal and retrieves the necessary information to get out of captivity</t>
  <t>Enforcement, in which the enforcement device in the network blocks disallowed traffic, and sends ICMP messages to let hosts know they are blocked by the captive portal</t>
</list></t>

<t>This document is focused on the second step. It is assumed that the location of the Captive Portal API server has been discovered by the host as part of the first step. The mechanism for discovering the API Server endpoint is not covered by this document.</t>

</section>
<section anchor="api-details" title="API Details">

<section anchor="uri-of-captive-portal-api-endpoint" title="URI of Captive Portal API endpoint">

<t>The URI of the API endpoint MUST be accessed using HTTP over TLS (HTTPS) and SHOULD be served on port 443 <xref target="RFC2818"></xref>.
The host SHOULD NOT assume that the URI for a given network attachment will stay the same, and SHOULD rely on the discovery or provisioning process each time it joins the network. Depending on how the Captive Portal system is configured, the URI may be unique for each host and between sessions for the same host.</t>

<t>For example, if the Captive Portal API server is hosted at example.org, the URI’s of the API could be:</t>

<t><list style="symbols">
  <t>“https://example.org/captive-portal/api”</t>
  <t>“https://example.org/captive-portal/api/X54PD”</t>
</list></t>

</section>
<section anchor="json-keys" title="JSON Keys">

<t>The Captive Portal API data structures are specified in JavaScript Object Notation (JSON) <xref target="RFC7159"></xref>.</t>

<t>The following keys are defined at the top-level of the JSON structure returned by the API server:</t>

<t><list style="symbols">
  <t>“permitted” (required, boolean): indicates whether or not the Captive Portal is open to the requesting host</t>
  <t>“hmac-key” (required, string): provides a per-host key that can be used to authenticate messages from the Captive Portal enforcement server</t>
  <t>“user-portal-url” (required, string): provides the URL of a web portal that can be presented to a user to interact with</t>
  <t>“expire-date” (optional, string formatted as <xref target="RFC3339"></xref> datetime): indicates the date and time after which the host will be in a captive state</t>
  <t>“bytes-remaining” (optional, integer): indicates the number of bytes left, after which the host will be in a captive state</t>
</list></t>

<t>Note that the use of the hmac-key is not defined in this document, but is intended for use in the enforcement step of the Captive Portal Architecture.</t>

</section>
<section anchor="example-exchange" title="Example Exchange">

<t>To request the Captive Portal JSON content, a host sends an HTTP GET request:</t>

<figure><artwork><![CDATA[
GET /captive-portal/api/X54PD
Host: example.org
Accept: application/json

]]></artwork></figure>

<t>The server then responds with the JSON content for that client:</t>

<figure><artwork><![CDATA[
HTTP/1.1 200 OK
Cache-Control: private
Date: Mon, 04 Dec 2013 05:07:35 GMT
Content-Type: application/json

{
   "permitted": false,
   "hmac-key": "7cec81acce3176b262a46363666a01881b0e3bf60d97a98b5409b71cc60a1ac0"
   "user-portal-url": "https://example.org/portal.html"
   "expire-date": "2014-01-01T23:28:56.782Z"
}
]]></artwork></figure>

</section>
</section>
<section anchor="security-considerations" title="Security Considerations">

<t>TBD: Provide complete security requirements and analysis.</t>

<section anchor="privacy-considerations" title="Privacy Considerations">

<t>Information passed in this protocol may include a user’s personal information, such as a full name and credit card details. Therefore, it is important that Captive Portal API Servers do not allow access to the Captive Portal API over unecrypted sessions.</t>

</section>
</section>
<section anchor="iana-considerations" title="IANA Considerations">

<t>TBD: None</t>

</section>
<section anchor="acknowledgments" title="Acknowledgments">

<t>This work in this document was started by Mark Donnelly and Margaret Cullen. Thanks to everyone in the CAPPORT Working Group who has given input.</t>

</section>


  </middle>

  <back>

    <references title='Normative References'>





<reference  anchor="RFC2818" target='https://www.rfc-editor.org/info/rfc2818'>
<front>
<title>HTTP Over TLS</title>
<author initials='E.' surname='Rescorla' fullname='E. Rescorla'><organization /></author>
<date year='2000' month='May' />
<abstract><t>This memo describes how to use Transport Layer Security (TLS) to secure Hypertext Transfer Protocol (HTTP) connections over the Internet.  This memo provides information for the Internet community.</t></abstract>
</front>
<seriesInfo name='RFC' value='2818'/>
<seriesInfo name='DOI' value='10.17487/RFC2818'/>
</reference>



<reference  anchor="RFC5785" target='https://www.rfc-editor.org/info/rfc5785'>
<front>
<title>Defining Well-Known Uniform Resource Identifiers (URIs)</title>
<author initials='M.' surname='Nottingham' fullname='M. Nottingham'><organization /></author>
<author initials='E.' surname='Hammer-Lahav' fullname='E. Hammer-Lahav'><organization /></author>
<date year='2010' month='April' />
<abstract><t>This memo defines a path prefix for &quot;well-known locations&quot;, &quot;/.well-known/&quot;, in selected Uniform Resource Identifier (URI) schemes.   [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='5785'/>
<seriesInfo name='DOI' value='10.17487/RFC5785'/>
</reference>



<reference  anchor="RFC7159" target='https://www.rfc-editor.org/info/rfc7159'>
<front>
<title>The JavaScript Object Notation (JSON) Data Interchange Format</title>
<author initials='T.' surname='Bray' fullname='T. Bray' role='editor'><organization /></author>
<date year='2014' month='March' />
<abstract><t>JavaScript Object Notation (JSON) is a lightweight, text-based, language-independent data interchange format.  It was derived from the ECMAScript Programming Language Standard.  JSON defines a small set of formatting rules for the portable representation of structured data.</t><t>This document removes inconsistencies with other specifications of JSON, repairs specification errors, and offers experience-based interoperability guidance.</t></abstract>
</front>
<seriesInfo name='RFC' value='7159'/>
<seriesInfo name='DOI' value='10.17487/RFC7159'/>
</reference>



<reference  anchor="RFC3339" target='https://www.rfc-editor.org/info/rfc3339'>
<front>
<title>Date and Time on the Internet: Timestamps</title>
<author initials='G.' surname='Klyne' fullname='G. Klyne'><organization /></author>
<author initials='C.' surname='Newman' fullname='C. Newman'><organization /></author>
<date year='2002' month='July' />
</front>
<seriesInfo name='RFC' value='3339'/>
<seriesInfo name='DOI' value='10.17487/RFC3339'/>
</reference>




    </references>

    <references title='Informative References'>





<reference anchor="I-D.ietf-capport-architecture">
<front>
<title>CAPPORT Architecture</title>

<author initials='K' surname='Larose' fullname='Kyle Larose'>
    <organization />
</author>

<author initials='D' surname='Dolson' fullname='David Dolson'>
    <organization />
</author>

<date month='September' day='29' year='2017' />

<abstract><t>This document aims to document consensus on the CAPPORT architecture. DHCP or Router Advertisements, ICMP, and an HTTP API are used to provide the solution.  The role of Provisioning Domains (PvDs) is described.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-ietf-capport-architecture-00' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-ietf-capport-architecture-00.txt' />
</reference>




    </references>



  </back>

<!-- ##markdown-source:
H4sIAFVOdVoAA6VY227bSBJ951c0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