One document matched: draft-ietf-httpauth-rest-auth-00.xml


<?xml version="1.0" encoding="UTF-8"?>
<?rfc tocindent="no"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc2119 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY rfc2616 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2616.xml">
<!ENTITY rfc2617 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2617.xml">
<!ENTITY rfc5246 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5246.xml">
<!ENTITY rfc5056 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5056.xml">
<!ENTITY rfc5929 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5929.xml">
<!ENTITY rfc5849 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5849.xml">
<!ENTITY I-D.ietf-oauth-v2 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.ietf-oauth-v2.xml">
<!ENTITY rfc4422 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4422.xml">
<!ENTITY rfc5802 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5802.xml">
<!ENTITY rfc4252 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4252.xml">
<!ENTITY rfc4559 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4559.xml">
<!ENTITY rfc6631 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6631.xml">
<!ENTITY rfc2743 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2743.xml">
<!ENTITY rfc5801 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5801.xml">
<!ENTITY rfc4121 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4121.xml">
]>
<rfc docName="draft-ietf-httpauth-rest-auth-00" ipr="trust200902" category="info">
  <front>
    <title abbrev="RESTful Authentication">RESTful Authentication Pattern for the Hypertext Transport Protocol (HTTP)</title>
    <author initials="N." surname="Williams" fullname="Nicolas Williams">
      <organization abbrev="Cryptonector">Cryptonector, LLC</organization>
      <address>
        <email>nico@cryptonector.com</email>
      </address>
    </author>
    <date month="August" year="2013"/>
    <area>
Security Area
</area>
    <keyword>Internet-Draft</keyword>
    <abstract>
      <t>
This document proposes a “RESTful” pattern of authentication for HTTP/1.0, 1.1, and 2.0. The goal is to make it easy to add authentication mechanisms to HTTP and to make it easy to implement them even without much help from the HTTP stack (though it is best to integrate authentication into the stack, of course).</t>
      <t>
Among other benefits of RESTauth: it is orthogonal to “HTTP routers” and proxies, it results in session Uniform Resource Identifiers (URIs) that can be DELETEd to logout, naturally supports multi-legged authentication schemes, and it can be universally implemented on the server side with the Common Gateway Interface (CGI) and FastCGI.</t>
    </abstract>
  </front>
  <middle>
    <section title="Introduction" anchor="sec_Introduction">
      <t>
We propose a pattern for HTTP <xref target="RFC2616"/> [XXX add reference to HTTP/2.0 as well?] authentication mechanisms that, by being “RESTful”, obtains a number of benefits:</t>
      <t>
        <list style="symbols">
          <t>
authentication that works with all versions of HTTP, even when the authentication mechanism requires multiple round trips;</t>
          <t>
compatibility with “HTTP routing” by making no assumptions that related requests are sent over the same TCP/TLS connection;</t>
          <t>
channel binding, or an HTTP session protocol such as <xref target="I-D.williams-websec-session-continue-proto"/> (or any other meeting requirements of HTTP session protocols, described in <xref target="I-D.williams-websec-session-continue-prob"/>), can be used instead of web cookies;

<list style="symbols"><t>
a “session URI” results that can be used to multiplex multiple sessions onto the same TCP/TLS connections;</t><t>
a “session URI” results that can be DELETEd to effect logout;</t><t>
a “session URI” results that has better security semantics than HTTP cookies;</t></list>
</t>
          <t>
the ability to refer to multiple sessions in one request wherever such a concept might be useful;</t>
          <t>
can be implemented by any application without changes being required to any HTTP stack;

<list style="symbols"><t>
but it can also be implemented by the HTTP stack;</t></list>
</t>
          <t>
on the server side this can be implemented entirely via CGI, FastCGI, WSGI, servlets, and so on;</t>
          <t>
by its RESTful nature, multi-round trip authentication message exchanges are naturally handled without making any changes to HTTP.</t>
        </list>
      </t>
      <t>
There are probably other benefits not listed above.</t>
      <section title="Protocol Outline" anchor="d1e469">
        <t>
          <list style="numbers">
            <t>
initial authentication messages are POSTed to an agreed-upon or indicated “login” resource...</t>
            <t>
....which then results in a new resource being created with the authentication reply message as the new resource's representation.</t>
            <t>
Thereafter any additional authentication message exchanges needed (for multi-legged mechanisms) are POSTed to the new resource without creating additional resources.</t>
            <t>
The resource created by the POSTing of the initial authentication mechanism identifies the resulting session, and its URI is known as the session URI.</t>
            <t>
Session URIs can be used to multiplex multiple sessions over the same TCP/TLS connections, implement logout, and share sessions across multiple related servers.</t>
          </list>
        </t>
        <t>
Authentication using mechanisms that require that the server send the first authentication message is also possible, in either of two ways: the initial authentication message is sent in headers in a 401 response, or the client POSTs an empty first message to the login resource.</t>
      </section>
      <section title="API-Imposed Constraints" anchor="d1e495">
        <t>
To the extent that existing Application Programming Interfaces (APIs) assume specific styles of HTTP authentication message flows, if we want those APIs to support RESTauth backwards-compatibly, then those APIs may impose constraints on RESTauth.</t>
        <t>
For example, the Android Account Manager API assumes a single round trip for authentication [XXX add reference!]. But the Android Account Manager could perform all but the last round trip on behalf of the application, then let the application perform the last round trip. In order for that to work we need the authentication message exchange to be orthogonal to TCP/TLS connections -- that is, we need it to be possible to use multiple TCP/TLS connections for completing a single authentication exchange. This is because the application and the account manager will likely be using different TCP/TLS connections.</t>
        <t>
A typical constraining characteristic might be that an API assumes the use of GET with tokens encoded into the URI or into a header, or that the API makes no room for the use of headers in authentication message exchanges.</t>
        <t>
One way to work around such constraints may be to provide various options in RESTauth. Another might be to use OAuth 1.0 <xref target="RFC5849"/> or 2.0 <xref target="I-D.ietf-oauth-v2"/> as a bridge: the API would use this framework under the covers then obtain OAuth credentials from the server that the application can then use in any way that the API's form allows for.</t>
        <t>
          <cref>
TODO: Add a table/list of various known APIs and their characteristics that might constrain this and/or other frameworks.</cref>
        </t>
      </section>
    </section>
    <section title="Conventions used in this document" anchor="d1e528">
      <t>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <xref target="RFC2119"/>.</t>
    </section>
    <section title="Protocol" anchor="sec_Protocol">
      <t>
The are few normative protocol elements here besides the outline given in  <xref target="sec_Introduction"/>. The normative protocol elements are:</t>
      <t>
        <list style="symbols">
          <t>
the form of the WWW-Authenticate header values -in 401 responses- for RESTauth mechanisms;</t>
          <t>
several new headers for advertising negotiable parameters that are orthogonal to WWW-Authenticate;</t>
          <t>
the POSTing of authentication messages from the client, with the initial client authentication message going to either a pre-agreed URI or to a URI named in the WWW-Authenticate headers;</t>
          <t>
the creation of a session URI as a result of the initial POST, and the subsequent POSTing of any additional authentication messages to the session URI;</t>
          <t>
the new session URI resource representation resulting from POSTs being the server's response authentication message, if any;</t>
          <t>
the DELETEion of session URIs as signaling logout;</t>
          <t>
a new header for referencing session URIs in normal HTTP requests;</t>
          <t>
the use of channel binding <xref target="RFC5056"/> to TLS <xref target="RFC5246"/> for session protection;</t>
        </list>
      </t>
      <t>
And for applications that may not use TLS/HTTPS:</t>
      <t>
        <list style="symbols">
          <t>
the use of session keys as an option for integrity protection when TLS is not used (a light-weight security mode); see <xref target="I-D.williams-websec-session-continue-proto"/>.</t>
        </list>
      </t>
      <section title="Negotiable Parameters" anchor="sub_Negotiable_Parameters">
        <t>
As can be seen in the ABNF in the preceding section, the server can offer some negotiable parameters. These are:</t>
        <t>
          <list style="symbols">
            <t>
Authentication mechanism names;</t>
            <t>
Channel binding types;</t>
            <t>
Session binding types;</t>
            <t>
Replay protection;</t>
          </list>
        </t>
        <t>
Each WWW-Authenticate <xref target="RFC2617"/> header value offers a single mechanism and negotiable parameters for it; because headers can have multiple values, WWW-Authenticate provides a method for negotiating authentication mechanisms. The WWW-ChannelBinding-Types header (added here) allows the server to list channel binding types supported by it.</t>
        <section title="Strong Binding to TLS" anchor="d1e641">
          <t>
Strong binding to TLS is provided via channel binding <xref target="RFC5056"/>. When a RESTauth mechanism provides strong authentication of the service to the user, the combination of RESTauth and channel binding results in strong authentication of the server to the user even though TLS is used for session transport protection.</t>
        </section>
        <section title="WWW-Authenticate Header Value Prefix Syntax" anchor="sub_WWW_Authenticate_Header_Value">
          <t>
The ABNF for RESTauth WWW-Authenticate header values is as follows:</t>
          <t>
</t>
          <t>
            <figure anchor="fig_WWW_Authenticate_ABNF" title="RESTauth WWW-Authenticate ABNF">
              <artwork>      challenge           = ( "RA-" mechname SP restauth-challenge )
      mechname            = 1*( ALPHA / DIGIT / "-" )
      restauth-challenge  = ( login-uri SP session-types SP
                              replay-prot SP *1(mech-challenge) )
      login-uri           = absoluteURI
      session-types       = "s=" session-type /
                            (session-type ":" session-types)
      session-type        = "cookie" / "session-ID" /
                            "channel-bound-session-ID" /
                            "MAC"
                            ; new session-types may be added
      replay-prot         = "r=" ("yes" / "no")
      mech-challenge      = <base64 encoded mech-specific data></artwork>
            </figure>
          </t>
          <t>
For a DIGEST-like mechanism it might look like “WWW-Authenticate: RA-Digest-SHA-256 tls-server-end-point session-ID no HE4SgWGrd/3+O7t16HqusA==”. For example, the mechname for the Kerberos V5 GSS-API mechanism might be “gss-krb5”, and a WWW-Authenticate header value for it might look like “WWW-Authenticate: RA-gss-krb5 http://foo.example/restauth-login tls-server-end-point channel-bound-session-ID r=no”.</t>
          <t>
Note that mechanisms that may be used include: GSS mechanisms, SASL mechanisms, ad-hoc mechanisms, and so on.</t>
        </section>
        <section title="WWW-ChannelBinding-Types Header" anchor="sub_WWW_ChannelBinding_Types_Header">
          <t>
A new header is added by which servers MUST indicate which channel binding <xref target="RFC5056"/> types -if any- they support for RESTauth authentication; if the server does not support channel binding then this header MUST be absent. The header is named WWW-ChannelBinding-Types. Its values are channel binding types from the channel binding type registry, such as the TLS channel binding types <xref target="RFC5929"/>.</t>
        </section>
        <section title="WWW-ChannelBinding-Type Header" anchor="sub_WWW_ChannelBinding_Type_Header">
          <t>
A new header is added by which clients MUST indicate what channel binding type they used when POSTing RESTauth authentication messages, if any; if the client did not use channel binding then this header MUST be absent. If the mechanism used has its own method for indicating the use of channel binding, then this header MAY be ommitted. The header is named WWW-ChannelBinding-Type. Its value is a channel binding type from the channel binding type registry <xref target="RFC5929"/>.</t>
        </section>
        <section title="WWW-SessionBinding-Type Header" anchor="sub_WWW_SessionType_Header">
          <t>
A new header is added by which clients MUST indicate what session binding type they choose when POSTing RESTauth authentication messages. The header is named WWW-SessionBinding-Type. Its value is a session binding type as shown in  <xref target="fig_WWW_Authenticate_ABNF"/>. This header SHOULD be present in RESTauth authentication HTTP requests, but may be ommitted when the selected mechanism provides its own session binding facility that is distinct from RESTauth's (this helps adapt OAuth to RESTauth with minimal or no changes).</t>
        </section>
        <section title="WWW-ReplayProtection Header" anchor="sub_WWW_ReplayProtection_Header">
          <t>
A new header is added by which clients MUST indicate whether they desire replay protection when POSTing RESTauth authentication messages. The header is named WWW-SessionBinding-Type. Its value is “yes” or “no” (defaults to “no” if absent) as shown in  <xref target="fig_WWW_Authenticate_ABNF"/>.</t>
          <t>
Replay protection is to be used only when TLS <xref target="RFC5246"/> is not used, and only if a session binding type of “MAC” is also requested.</t>
        </section>
      </section>
      <section title="Protocol Flow" anchor="sub_Protocol_Flow">
        <t>
RESTauth can be initiated by a client that knows a priori that it needs to or wants to use RESTauth. Servers can also tell clients that access to certain resources require authentication, possibly including RESTauth mechanisms. When the server tells the client that it must authenticate (using a 401 response, as usual), the server may also give the client an initial authentication message for one or more mechanisms.</t>
        <t>
When the client knows a priori that it must authenticate then the client MUST know the RESTauth login URI a priori as well, as well as negotiable parameters, all of which the client might know from either an application protocol specification, or from caching this information from earlier RESTauth exchanges.</t>
        <t>
The server MUST use a 401 HTTP status code and WWW-Authenticate headers to inform the client of the need to authenticate in order to access a given resource. For RESTauth mechanisms the WWW-Authenticate header values MUST conform to the ABNF given in  <xref target="sub_WWW_Authenticate_Header_Value"/>.</t>
        <t>
To proceed the client chooses a suitable authentication mechanism (for which, presumably, it has credentials for a desired client identity), possibly a channel binding type, possibly a session type, and whether to use replay protection.</t>
        <section title="One Round Trip Optimization: Challenges Borne in WWW-Authenticate Headers" anchor="sub_One_Round_Trip">
          <t>
Some mechanisms may optimize the protocol flow by allowing the server to include challenges in the 401 response's WWW-Authenticate header values. DIGEST-MD5 works this way, for example, sending a challenge nonce to be fed into the digest function (along with other client-side inputs).</t>
          <t>
RESTauth allows this, but this feature is OPTIONAL: it must always be possible for a client to initiate RESTauth without first obtaining a challenge in a WWW-Authenticate header value, in which case the client may incur an extra protocol leg by obtaining the challenge (if it is at all necessary) in the server's reply to the client's first authentication message. There are two reasons for making this optional:</t>
          <t>
            <list style="numbers">
              <t>
to allow client applications that know a priori that they must authenticate (and how to), requiring no further negotiation;</t>
              <t>
to support authentication mechanisms that require that the client initiate authentication message exchanges.</t>
            </list>
          </t>
          <t>
A challenge may consist of a nonce, some encrypted or MACed nonce, a time-stamp, certificates and digital signatures, etcetera. The server may include a login URI in challenge-laden WWW-Authenticate headers where the login URI encodes secure state regarding the challenge (e.g., the challenge encrypted in a symmetric key known only to the server).</t>
        </section>
      </section>
      <section title="Session Binding Types: Cookie, Session URI, and MAC" anchor="sub_Session_Binding_Types_">
        <t>
A notion of session binding type is added for binding HTTP requests to specific RESTauth login sessions. Three types are provided:</t>
        <t>
          <list style="hanging">
            <t hangText="Cookies">
 The traditional HTTP cookie approach to session binding;</t>
            <t hangText="Session URI">
 HTTP requests carry a WWW-Session-URI header identifying the session(s) (similar to cookies, but without all the associated baggage);</t>
            <t hangText="Channel Bound Session URI">
 Like Session URI, but may only be used in HTTPS connections with the same channel bindings. (This implies use of the 'tls-server-end-point' channel binding type.)</t>
            <t hangText="MAC">
 HTTP requests carry a WWW-Session-URI header identifying the session(s) and a WWW-Session-MAC header that carries a MAC or MACs binding the session URI(s) to the request.</t>
          </list>
        </t>
        <section title="The New WWW-Session-URI Header" anchor="sub_The_New_WWW_Session_URI">
          <t>
A new HTTP header is added called WWW-Session-URI whose values consist of session URIs. At least one session URI MUST be included. Each session URI is an absoluteURI. Session URIs MUST NOT have unescaped commas (',') embedded in them. Servers MAY fail to implement support for multiple session URIs being referenced by a single request, in which case they MUST answer with error code <TBD>. Servers MUST validate the session URI before processing the request; if the session URI is invalid the server MUST respond with a 401 (or TBD?) status code.</t>
          <t>
Note that referencing multiple session URIs is permitted, but this may not be meaningful for the application, thus the server MAY reject this (TODO: specify a status code for this?).</t>
          <t>
            <cref>
I can imagine a webmail application where a client can be logged in as multiple users and get a unified view of the users' mailboxes. This seems unlikely, but why rule out such use cases?</cref>
          </t>
        </section>
        <section title="The New WWW-Session-MAC Header" anchor="sub_The_New_WWW_Session_MAC">
          <t>
            <cref>
Describe the header, its values, algorithm agility, and what the MAC is to be taken over. Note too that this cannot apply to request contents as we have to consider chunking, and besides, a MAC of contents really has to go as a trailer, not a header.</cref>
          </t>
          <t>
            <cref>
We may want to remove this anyways and leave it for a session continuation spec. Or we may want to require the use of HTTPS.</cref>
          </t>
        </section>
        <section title="A MAC Trailer??" anchor="sub_A_MAC_Trailer__">
          <t>
            <cref>
... This is only needed for RESTauth *without* TLS, which will probably not be the common mode of use for RESTauth... unless we can produce a MAC trailer extension for HTTP/2.0, in which case this may well become a common mode of RESTauth usage.</cref>
          </t>
          <t>
            <cref>
We may want to remove this anyways and leave it for a session continuation spec. Or we may want to require the use of HTTPS.</cref>
          </t>
        </section>
      </section>
    </section>
    <section title="Representation of Authenticated Session Resources" anchor="d1e902">
      <t>
It will generally be useful to be able to GET a session resource to obtain information about the authenticated user. A GET on a session resource which is not fully established SHOULD return an empty body.</t>
      <t>
        <cref>
TODO: Add a media type for session resource representation.</cref>
      </t>
      <t>
        <cref>
Use JSON instead of ABNF? A schema language would be nice.</cref>
      </t>
      <t>
</t>
      <t>
        <figure anchor="magicparlabel-251" title="Session resource representation ABNF">
          <artwork>  session             = 1*( session-param )
  session-param       = session-param-name '=' session-param-value
  session-param-name  = 1*( ALPHA / DIGIT / '-' / '_' )
  session-param-value = <quoted or base64></artwork>
        </figure>
      </t>
      <t>
Session parameters include:</t>
      <t>
        <list style="hanging">
          <t hangText="established">
 “true” or “false”</t>
          <t hangText="expiration_time">
 Datetime when the session expires.</t>
          <t hangText="session_key_MAC_req">
 Session key for MACs in requests.</t>
          <t hangText="session_key_MAC_resp">
 Session key for MACs in responses.</t>
          <t hangText="authorization_data">
 Information about the authenticated user.</t>
          <t hangText="user_id">
 The authenticated user identity.</t>
        </list>
      </t>
      <t>
The server MAY exclude any part of this when the entity requesting a session resource is the session's user. The server MUST exclude (or respond with 401) all of the session resource's representation when the entity requesting it is not authenticated or authorized to see it. The server SHOULD exclude locally-determined authorization_data and/or user_id information when the entity requesting the resource is the session's user.</t>
    </section>
    <section title="HTTP “Routing” and Authentication" anchor="sec_HTTP_Routing_and">
      <t>
It is common to deploy HTTP services with load-balanced servers behind a load balancer and TLS concentrator. Other techniques may also result in a multiplicity of servers acting on behalf of a single service. The load balancers may even behave like routers and route HTTP requests to the same server for all requests in a single connection, or even route HTTP requests according to the verb and resource. It helps to be able to have a notion of authenticated sessions that can be referenced by all servers responding to a given service name.</t>
      <t>
The server end of a RESTauth authentication message exchange may be terminated by one server, by many servers sharing session state (via the resources named by session URIs), or by a server-side HTTP router. Once a RESTauth session is established we assume that all servers responding to the same service name will be able to access the session resource, validate session URIs, and obtain keys for computing and validating session binding MACs. Alternatively, the router may take responsibility for session binding and signal authorization information from the established session to the HTTP servers behind the router (however, we do not here specify any methods for such signaling).</t>
      <t>
By using REST for the authentication message exchange we allow this disconnection between “session” and “connection”, which therefore facilitates “routing” of HTTP requests and even off-loading of authentication and/or session binding to HTTP “routers”.</t>
      <t>
This approach should be flexible enough for all existing architectures for deploying HTTP services.</t>
    </section>
    <section title="In-band HTTP Authentication Alternatives" anchor="d1e998">
      <t>
RESTauth is “out-of-band” in the sense that the authentication messages are exchanged independently of the application's requests for normal resources. Of course, RESTauth exchanges may well (and often will) happen in the same TCP/TLS connection as normal application requests, so RESTauth is not really out-of-band. We use “out-of-band” and “in-band” very loosely in this section.</t>
      <t>
There exist several “in-band” HTTP authentication alternatives where the authentication message exchanges happen in the context of application resources. Here the HTTP verb and resource are application-specific and have nothing to do with authentication, and the authentication messages are exchanged via HTTP request and response headers with the server responding with a 401 status code until authentication is complete.</t>
      <t>
The extant “Basic” and “DIGEST-MD5” <xref target="RFC2617"/> HTTP authentication methods, as well as HTTP/Negotiate <xref target="RFC4559"/> are “in-band” HTTP authentication methods.</t>
      <t>
In so far as an in-band authentication method results in a cookie or session URI/ID the distinction between in-band and out-of-band is almost trivial, as described above: authentication messages in headers vs. bodies, and HTTP verb and URL. However, if in-line authentication methods are strongly tied to the TCP/TLS connections over which they were utilized then that is a big disadvantage over RESTauth: each connection requires re-authenticating, and support for HTTP routing schemes is not clear.</t>
      <t>
HTTP/Negotiate is more troublesome because historically it has required re-authentication per-HTTP request(!).</t>
      <t>
Even if the only difference between in-band and out-of-band is a trivial one, using the REST pattern means that authentication can be implemented using with no help from the HTTP stack (even though it's desirable to have it implemented within/by the HTTP stack), whereas there may not be a way to implement in-band authentication without help from the HTTP stack for some stacks.</t>
    </section>
    <section title="Sample/Potential RESTauth Authentication Mechanisms" anchor="sec_Sample_Potential_RESTauth_Authen">
      <t>
Here we describe (informatively, for the time being) how to use or adapt a variety of authentication mechanisms, from SSHv2, IKEv2, SASL, GSS-API, and other frameworks, so as to quickly gain a set of usable mechanisms, both, specification- and implementation-wise. This section is also intended to show that adding RESTauth mechanisms is easy.</t>
      <section title="OAuth via RESTauth" anchor="sub_OAuth_via_RESTauth">
        <t>
OAuth 1.0 RFC5849 and OAuth 2.0 <xref target="I-D.ietf-oauth-v2"/> are commonly deployed. Being able to use OAuth via RESTauth would be useful. We attempt to make RESTauth such that at least for OAuth 1.0 there is a standard way to use OAuth such that it conforms to RESTauth.</t>
        <section title="OAuth 1.0" anchor="sub_OAuth_1_0">
          <t>
For OAuth 1.0 <xref target="RFC5849"/> the “form-encoded body” form (see section 3.5.2 of <xref target="RFC5849"/>) of OAuth 1.0 conforms to RESTauth without further changes.</t>
        </section>
        <section title="OAuth 2.0" anchor="sub_OAuth_2_0">
          <t>
[It looks like OAuth 2.0 <xref target="I-D.ietf-oauth-v2"/> also uses POST to send tokens to the server, and it looks like it too effectively conforms to RESTauth.]</t>
        </section>
      </section>
      <section title="Adapting SSHv2 Authentication Mechanisms to RESTauth" anchor="sub_Adapting_SSHv2_Authentication">
        <t>
SSHv2 “userauth” mechanisms <xref target="RFC4252"/> typically involve a digital signature (or similar) of an SSHv2 session ID. There is no such thing as an SSHv2 session ID in HTTP. A session URI cannot serve as a stand-in for an SSHv2 session ID because a) the session URI is an outcome of authentication in RESTauth, b) to prevent cut-n-paste and replay attacks the client and the server both must contribute to the entropy of the session ID that is signed by the client.</t>
        <t>
In order to adapt SSHv2 userauth methods properly (i.e., securely), we have replace the SSHv2 session ID in the to-be-signed data with a hash of the channel binding and nonces contributed by the client and the server. As an optimization the server nonce can be sent as a challenge (this saves a round trip).</t>
        <section title="RESTauth Mechanism Names for SSHv2 Userauth Methods" anchor="d1e1124">
          <t>
For hash agility reasons the hash function name is part of the SSHv2 RESTauth mechanism name. To avoid “multi-level negotiation” the SSHv2 userauth method name is also part of the RESTauth mechanism name.</t>
          <t>
The RESTauth mechanism name form for SSHv2 userauth methods, then, is: ssh-<SSHv2-userauth-method-name>-<hash-function-name>.</t>
          <t>
The following RESTauth mechanisms are defined here:</t>
          <t>
            <list style="symbols">
              <t>
ssh-publickey-SHA-256</t>
              <t>
ssh-hostbased-SHA-256</t>
            </list>
          </t>
        </section>
        <section title="Nonces" anchor="d1e1146">
          <t>
The client and the server must each contribute 128-bit nonces.</t>
        </section>
        <section title="“Session ID”" anchor="d1e1155">
          <t>
The ssh-publickey-SHA-256 and ssh-hostbased-SHA-256 mechanisms use the following instead of a traditional SSHv2 session ID:</t>
          <t>
            <list style="symbols">
              <t>
SHA-256(channel_binding || server_nonce || client_nonce)</t>
            </list>
          </t>
          <t>
Here the <channel_binding> is as per-<xref target="RFC5056"/>: the channel binding type name, followed by the channel binding data (e.g., 'tls-server-end-point' followed by the server EE certificate as sent in the server's TLS Certificate message).</t>
          <t>
Note that use of channel binding when using SSHv2 mechanisms is REQUIRED so as to defeat cut-n-paste attacks by weakly-authenticated servers.</t>
        </section>
      </section>
      <section title="Adapting IKEv2 Authentication Mechanisms to RESTauth" anchor="sub_Adapting_IKEv2_Authentication">
        <t>
          <cref>
TBD.</cref>
        </t>
        <section title="Adapting IKEv2 Password Authenticated Connection Establishment (PACE) to RESTauth" anchor="sub_Adaptinve_IKEv2_Password">
          <t>
            <cref>
TBD.</cref>
          </t>
        </section>
      </section>
      <section title="Using SASL Authentication Mechanisms with RESTauth" anchor="sub_Using_SASL_Authentication">
        <t>
Simple Authentication and Security Layers (SASL) <xref target="RFC4422"/> is a simple, pluggable framework for authentication mechanisms.</t>
        <t>
To use a SASL mechanism in RESTauth just prefix “SA-” to the SASL mechanism name and use that as the RESTauth mechanism name. If the SASL mechanism is server-initiated then the server's challenge is sent in the server's WWW-Authenticate header value as described above. All other SASL authentication messages are exchanged as described above (i.e., via POSTs, first to the login URI, then to the session URI, with response messages as the new representation of the session resource).</t>
        <t>
The HTTP status code functions as the application's outcome of authentication message. If SASL succeeds but authorization fails then the server should respond with a 401 status code to the POST of the final SASL authentication message from the client.</t>
        <t>
The server's WWW-Authenticate header values function as the mechanism listing operation. SASL security considerations <xref target="RFC4422"/>
<xref target="RFC5801"/> apply (particularly regarding the negotiation of channel binding support).</t>
        <section title="Using SCRAM in RESTauth" anchor="sub_Using_SCRAM_in">
          <t>
The Salted Challenge Response Authentication Mechanism (SCRAM) <xref target="RFC5802"/> is a DIGEST-like mechanism for SASL. Nothing special is needed to use SCRAM versus any other SASL mechanism, except for a round trip optimized form of SCRAM, if we decide to pursue that (see  <xref target="sub_Using_SCRAM_with"/>).</t>
          <t>
The following figure shows what SCRAM in RESTauth looks like. Note that the resource representations are taken verbatim from <xref target="RFC5802"/>.</t>
          <t>
</t>
          <t>
            <figure anchor="magicparlabel-413" title="RESTauth w/ SCRAM">
              <artwork>  C->S: GET /some-resources HTTP/1.1
        Host: A.example
 
  S->C: HTTP/1.1 401 Unauthorized
        WWW-Authenticate: RA-SA-SCRAM-SHA-1 \
                          http://A.example/rest-sa-scram \ 
                          s=session-ID,MIC r=no
        WWW-ChannelBinding-Types: tls-server-end-point
 
  C->S: POST /rest-sa-scram HTTP/1.1
        Host: A.example
        WWW-ChannelBinding-Type: tls-server-end-point
        WWW-SessionBinding-Type: session-ID
        Content-Type: application/octet-stream
        Content-Length: nnn
 
        n,,n=user,r=fyko+d2lbbFgONRv9qkxdawL
 
  S->C: HTTP/1.1 201
        Location http://A.example/restauth-9d0af5f680d4ff46
        Content-Type: application/octet-stream
        Content-Length: nnn
 
        r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,
        s=QSXCR+Q6sek8bf92,i=4096
 
  C->S: POST /restauth-9d0af5f680d4ff46 HTTP/1.1
        Host: A.example
        Content-Type: application/octet-stream
        Content-Length: nnn
 
        c=biws,r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,
        p=v0X8v3Bz2T0CJGbJQyF0X+HI4Ts=
 
  S->C: HTTP/1.1 200
        Content-Type: application/octet-stream
        Content-Length: nnn
 
        v=rmF9pqV8S7suAoZWja4dJRkFsKQ=
 </artwork>
            </figure>
          </t>
        </section>
        <section title="Using SCRAM with Round Trip Optimization in RESTauth" anchor="sub_Using_SCRAM_with">
          <t>
            <cref>
This might work by having the authentication ID function as the salt and the server offering a challenge nonce and iteration count in its optimistic challenge. However, it's not clear that a round trip optimized form of SCRAM is desirable.</cref>
          </t>
          <t>
The following figure shows what a round trip optimized RESTauth w/ SCRAM exchange might look like.</t>
          <t>
            <cref>
NOTE: SCRAM was not intended to be used this way. In particular this approach forces the use of an algorithmic salt, to be derived only from either the username or the username and the server's name (or else to be remembered by the user, but that's not likely).</cref>
          </t>
          <t>
</t>
          <t>
            <figure anchor="magicparlabel-458" title="RESTauth w/ round trip optimized SCRAM">
              <artwork>  C->S: GET /some-resources HTTP/1.1
        Host: A.example
 
  S->C: HTTP/1.1 401 Unauthorized
        WWW-Authenticate: RA-SA-SCRAM-SHA-1 \
                          http://A.example/rest-sa-scram \
                          s=session-ID,MIC r=no \
                          r=fyko+d2l...JY1ZVvWVs7j,i=4096
        WWW-ChannelBinding-Types: tls-server-end-point
 
  C->S: POST /rest-sa-scram HTTP/1.1
        Host: A.example
        WWW-ChannelBinding-Type: tls-server-end-point
        WWW-SessionBinding-Type: session-ID
        Content-Type: application/octet-stream
        Content-Length: nnn
 
        n,,n=user,r=fyko+d2lbbFgONRv9qkxdawL,
        c=biws,r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,
        p=v0X8v3Bz2T0CJGbJQyF0X+HI4Ts=
 
  S->C: HTTP/1.1 200
        Content-Type: application/octet-stream
        Content-Length: nnn
 
        v=rmF9pqV8S7suAoZWja4dJRkFsKQ=
 </artwork>
            </figure>
          </t>
        </section>
      </section>
      <section title="Using GSS-API Authentication Mechanisms with RESTauth" anchor="sub_Using_GSS_API_Authentication">
        <t>
The Generic Security Services Application Programming Interface (GSS-API) <xref target="RFC2743"/> is another pluggable mechanism framework. Any GSS-API mechanism that supports channel binding <xref target="RFC5056"/> can be used as SASL mechanisms via the “SASL/GS2” bridge <xref target="RFC5801"/>. This includes the Kerberos V5 GSS-API mechanism <xref target="RFC4121"/>.</t>
        <t>
GSS-API security mechanisms could also be used without SASL/GS2, but SASL/GS2 barely adds any overhead or complexity (a SASL implementation is not required in order to use SASL/GS2, just a GSS implementation): a simple header is to be prefixed to the initial security context token and to the channel binding data, with both peers always providing channel binding data.</t>
      </section>
    </section>
    <section title="IANA Considerations" anchor="sec_IANA_Considerations">
      <t>
TBD (header registrations, ...)</t>
    </section>
    <section title="Security Considerations" anchor="sec_Security_Considerations">
      <t>
This entire document deals with security considerations. [Add more, like about channel binding, same-origin-like constraints on the login and session absolute URIs', ...]</t>
    </section>
    <section title="TODO" anchor="sec_TODO">
      <t>
        <cref>
Add references (to HTTP/2.0, CGI/fCGI, ...).</cref>
      </t>
      <t>
        <cref>
Describe MAC session binding option and replay protection in detail -- or remove it altogether. Describe how to extract keys for MAC keying from SASL/GSS/PACE.</cref>
      </t>
      <t>
        <cref>
Figure out how to adapt IKEv2 password-based methods to RESTauth. This may not be worthwhile (since each method tends to depend heavily on the entire IKEv2 framework in ways that add messaging that we'd not need in RESTauth).</cref>
      </t>
      <t>
        <cref>
Do we need to distinguish exchanges for authentication from exchanges for authorization? Probably.</cref>
      </t>
    </section>
  </middle>
  <back>
    <references title="Normative References">&rfc2119;
&rfc2616;
&rfc2617;
&rfc5246;
&rfc5056;
&rfc5929;

<reference anchor="I-D.williams-websec-session-continue-prob"><front><title>Hypertext Transport Protocol (HTTP) Session Continuation: Problem Statement</title><author initials="N." surname="Williams" fullname="Nicolas Williams"><organization/></author><date month="January" day="1" year="2013"/><abstract><t>Abstract One of the most often talked about problems in web security is “cookies”. Web cookies are a method of associating requests with “sessions” that may have been authenticated somehow. Cookies are a form of bearer token that leave much to be desired. This document describes the session “continuation” problem for the HyperText Transport Protocol (HTTP).</t></abstract></front><seriesInfo name="Internet-Draft" value="draft-williams-websec-session-continue-prob-00"/><format type="TXT" target="http://www.ietf.org/internet-drafts/draft-draft-williams-websec-session-continue-prob-00.txt"/></reference> 
<reference anchor="I-D.williams-websec-session-continue-proto"><front><title>Hypertext Transport Protocol (HTTP) Session Continuation Protocol</title><author initials="N." surname="Williams" fullname="Nicolas Williams"><organization/></author><date month="January" day="1" year="2013"/><abstract><t>Abstract One of the most often talked about problems in web security is “cookies”. Web cookies are a method of associating requests with “sessions” that may have been authenticated somehow. Cookies are a form of bearer token that leave much to be desired. This document proposes a session “continuation” protocol for HyperText Transport Protocol (HTTP).</t></abstract></front><seriesInfo name="Internet-Draft" value="draft-williams-websec-session-continue-proto-00"/><format type="TXT" target="http://www.ietf.org/internet-drafts/draft-draft-williams-websec-session-continue-proto-00.txt"/></reference> </references>
    <references title="Informative References">&rfc5849;
&I-D.ietf-oauth-v2;
&rfc4422;
&rfc5802;
&rfc4252;
&rfc4559;
&rfc6631;
&rfc2743;
&rfc5801;
&rfc4121;
</references>
  </back>
</rfc>

PAFTECH AB 2003-20262026-04-24 11:13:30