<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
  <!ENTITY RFC0793 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.0793.xml'>
  <!ENTITY RFC1738 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.1738.xml'>
  <!ENTITY RFC1950 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.1950.xml'>
  <!ENTITY RFC2119 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>
  <!ENTITY RFC2285 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2285.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 RFC2818 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2818.xml'>
  <!ENTITY RFC4366 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4366.xml'>
  <!ENTITY RFC4559 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4559.xml'>
  <!ENTITY RFC5246 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5246.xml'>
  <!ENTITY RFC6454 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.6454.xml'>
  <!ENTITY RFC6455 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.6455.xml'>
]>

<?xml-stylesheet type="text/xsl" href="rfc2629.xml"?>

<?rfc toc="yes" symrefs="yes"?>

<rfc ipr="trust200902" docName="draft-montenegro-httpbis-multilegged-auth-01">
  <front>
    <title abbrev="HTTP Multilegged Auth">Multilegged Authentication for HTTP Multiplexing</title>
    <author initials="J." surname="Silvera" fullname="Jonathan Silvera">
      <organization>Microsoft</organization>
      <address>
        <email>JSilvera@microsoft.com</email>
      </address>
    </author>
    <author initials="M." surname="Cox" fullname="Matthew Cox">
      <organization>Microsoft</organization>
      <address>
        <email>MaCox@microsoft.com</email>
      </address>
    </author>
    <author initials="I." surname="Pashov" fullname="Ivan Pashov">
      <organization>Microsoft</organization>
      <address>
        <email>IvanPash@microsoft.com</email>
      </address>
    </author>
    <author initials="O." surname="Mazahir" fullname="Osama Mazahir">
      <organization>Microsoft</organization>
      <address>
        <email>OsamaM@microsoft.com</email>
      </address>
    </author>
    <author initials="G." surname="Montenegro" fullname="Gabriel Montenegro">
      <organization>Microsoft</organization>
      <address>
        <email>Gabriel.Montenegro@microsoft.com</email>
      </address>
    </author>

    <date month="July" year="2012" /> <area>Applications</area> 
    <keyword>HTTP</keyword> 
    <abstract> 
    <t>  
    In line with the HTTP compatibility goal for HTTP 2.0, HTTP 2.0 must also be compatible with 
    currently deployed authentication schemes. This draft addresses this goal in the presence of 
    multiplexing (expected to be part of HTTP 2.0), while addressing 
    some of the issues currently encountered when performing multilegged authentication. 
    </t> 
    </abstract> 

    </front>

  <middle> 

  <section anchor="overview" title="Overview"> 

  <t> 
     This document defines multilegged authentication for HTTP multiplexing.
  </t>

  <t> 
     Without reliable support for Kerberos and other multilegged auth schemes, the 
     reach of HTTP2.0 will be greatly diminished in corporations that rely on these 
     authentication schemes to protect their intranet resources.
  </t>

   <t>
HTTP's architecture requires that messages be stateless; that is, that they are able to be interpreted in isolation, without relying upon state from "lower" layers, such as association between requests using the same TCP connection. To enable better support of multilegged authentication, we propose that the shared state for which some authentication schemes rely upon the TCP connection (thereby making messages stateful) be moved into the HTTP/2.0 session layer.
  </t>
  <t>
     The following table summarizes widely deployed authentication schemes, 
     their authentication types and the authentication level they provide:
  </t>

    <figure>
      <artwork>
     Table 1: 
     +-----------+------------------------+----------------------+
     | Scheme    | Type of Authentication | Authentication Level |
     +-----------+------------------------+----------------------+
     | Basic     |      Per Request       |       Request        | 
     | Digest    |      Per Request       |       Request        | 
     | NTLM      |      Multilegged       |       Connection     | 
     | Kerberos  |      Multilegged       |Connection or Request | 
     | Negotiate |      Multilegged       |Connection or Request |
     +-----------+------------------------+----------------------+      
      </artwork>
    </figure>

  <t>
     RFC 2616 defines HTTP as a stateless protocol and dictates that authentication 
     schemes MUST be stateless. However, multilegged             
     authentication support for multiplexing requires state to associate separate 
     request/response pairs that are part of the same multilegged authentication 
     process. 
  </t>
<section title="Requirements Language">
  <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 [RFC2119].
  </t>
</section>
</section>



<section title="Multilegged Authentication in HTTP 1.X">
	<t>
     As implied by its name, multilegged authentication requires multiple roundtrips
     to establish an authenticated communication channel between client and server. If
     the resource requested by a client requires authentication, the server initiates 
     the authentication process as follows:
	</t>
    <figure>
      <artwork><![CDATA[
     Figure 1: Multilegged authentication example:
     
       Client                                 Server
         |                                      |
         | -------- (0) HTTP GET Request ---->  |
         |                                      |
         | <------- (1) HTTP 401 -------------  |
         |                                      |
         | -------- (2) HTTP Get Request ---->  |
         |              w Auth header           |
         |                                      |
         | <------- (3) HTTP 401 -------------  |
         |                                      |
         | -------- (4) HTTP Get Request ---->  |
         |              w Auth header           |
         |                                      |
         | <------- (5) HTTP 200 OK-----------  |
         |                                      |
         |                                      |
         v                                      v

      ]]></artwork>
    </figure>

    <t>
        <list style='numbers'>
        	<t> 
        	Server sends HTTP 401 response because the resource requested requires 
			authentication.
        	</t>

        	<t>
        	Client re-issues the HTTP GET request for the resource, including authentication 
			headers.
        	</t>

        	<t> 
        	Server responds with an HTTP 401 and authentication headers requesting
			additional information.
        	</t>

        	<t> 
        	Client re-issues the HTTP GET Request for the resource, including authentication 
			headers with the additional information required to complete authentication.
        	</t>
        	<t> 
        	If authentication succeeds, the server responds with an HTTP 200 OK message 
			including the requested resource.
        	</t>
        </list>
    </t>
	<t>
     Multilegged authentication requires state to be communicated between multiple
     streams. Network flows 3 and 4 in Figure 1 need to share state in order for 
     authentication to succeed.  Some multilegged authentication schemes (i.e. Kerberos
     and Negotiate) can authenticate either a connection or individual requests, which
     has historically caused a lot if issues with multilegged authentication in HTTP 1.1.
    </t>


</section>

<section title="Multilegged Authentication in the Presence of HTTP 2.0 Multiplexing">
	<t>
       Figure 2 below provides a detailed breakdown of proposed network flows to implement
       multilegged authentication for HTTP 2.0 multiplexing: 
	</t>
    <figure>
      <artwork><![CDATA[
       Figure 2 - Proposed multilegged authentication:

                                           Multiplexing
      Client                           HTTP Server
         |                                      |
         | --------   HTTP GET Request ------>  |
         |                                      |
         | <------- (0) HTTP 401 -------------  |
         |                                      |
         | -------- (1) HTTP Get Request ---->  |
         |              w Auth header           |[Auth-ID header
         |                                      | generated (1.5)]
         | <------- (2) HTTP 401 -------------  |
         |              w Auth-ID header        |                        
         |                                      |
         | -------- (3) HTTP Get Request ---->  |[Persisted-auth header
         |              w Auth header and       | generated (3.5)]
         |              Auth-ID header          |
         |                                      |
         | <------- (4) HTTP 200 OK-----------  |
         |              w optional              |
         |              PersistedAuth header    |
         |                                      |
         |                                      |
         v                                      v


      ]]></artwork>
    </figure>

    <t>
        <list style='numbers'>
        	<t> 
        	Server sends HTTP 401 response because the resource requested requires 
			authentication.
        	</t>

        	<t> 
	        Client re-issues the HTTP GET request for the resource, including authentication 
				headers.
				
		<vspace blankLines="1" />

	          Multilegged authentication schemes could authenticate individual requests or
	          the HTTP 2.0 session. Clients SHOULD NOT authenticate individual streams belonging
	          to an authenticated HTTP 2.0 session. The following describes client behavior when
	          attempting to authenticate streams, for which it does not know if the negotiation
	          will result in request based or HTTP 2.0 session based authentication:

		<vspace blankLines="1" />

	          If an HTTP 2.0 session has a stream in process of authenticating using a 
	          multilegged authentication scheme, the client SHOULD queue all subsequent requests
	          (regardless of whether they require authentication) on the session until
	          the multilegged authentication completes. 

		<vspace blankLines="1" />

	          If a server receives multiple authenticated requests from the same client, it
	          SHOULD NOT block responses. It is the client's responsibility to queue requests 
	          when a multilegged stream authentication process has been initiated in the 
	          session. If the client does not queue the requests, then it might
	          unnecessarily authenticate streams in a session that has already been 
	          authenticated.

		<vspace blankLines="1" />

	          If connection-based multilegged authentication succeeds on a previously 
	          authenticated session, the server SHOULD discard the previous authentication
	          context and authenticate the session with the newly negotiated authentication
	          context.
			
        	</t>

        	<t> 
	        	Server responds with an HTTP 401 and authentication headers requesting
				additional information.

		<vspace blankLines="1" />

	          A session's lifetime is not tied to the duration of a request/response pair.
	          If the authentication scheme used to validate the client's identity is a
	          multilegged scheme, servers MUST generate a new "Auth-ID" (1.5 in Figure 2) header. 
	          The Auth-ID value is an opaque blob that SHOULD NOT be interpreted. It MUST
	          be sent in its complete form to continue an authentication process. The server 
	          uses this to look up the correct security context to process this authentication 
	          request.
		<vspace blankLines="1" />

	          The HTTP 401 response from the server MUST contain the "Auth-ID" header to enable 
	          sharing of authentication context across streams, as required for multilegged 
	          authentication.
        	</t>

        	<t> 
        	Client re-issues the HTTP GET request for the resource and MUST include the required
			authentication headers and the "Auth-ID" header, to inform the server that the
			request is part of a previously initiated multilegged authentication process.
        	</t>

        	<t>
		Authentication succeeds and the server returns the requested resource, along with
				level of multilegged authentication scheme:
		<vspace blankLines="1" />

	          Some multilegged authentication schemes can result in per-request or
	          per-connection (i.e., Kerberos or Negotiate) authentication. When a session is
		      authenticated, servers MUST generate a Persistent-auth header 3.5 in Figure 2) and
			  send it along with the HTTP 200 OK response. The client MUST use the presence
			  or absence) of the Persistent-auth header to determine what action to take with 
			  previously queued requests due to multilegged authentication being in progress: 
		<vspace blankLines="1" />

				<list style='numbers'>
					<t> 
						If the session was authenticated, as indicated by the presence of the
		               Persistent-auth header, the client does not need to authenticate new streams
		               it creates to service the queued requests on the authenticated session.
		<vspace blankLines="1" />

		               Clients SHOULD assume that successful authentication with schemes that only
		               support connection-based authentication (i.e. NTLM) always result in an 
		                authenticated session, even if the Persisted-auth header is not present.
					</t>

	                <t>
		                If the session was not authenticated, as indicated by the absence of the
		                Persistent-auth header, the client SHOULD remember the negotiated
		                authentication scheme used for authentication.  The client SHOULD NOT block
		                streams on the session when processing requests using the multilegged
		                authentication scheme that previously resulted in per-request authentication.
					</t>
	            </list>
		<vspace blankLines="1" />

	          A server MAY generate and add Auth-ID header as soon as it knows that the
	          requested authentication scheme is multilegged. The client MUST add the
	          Auth-ID header to all subsequent requests required to complete the authentication
	          process.
		<vspace blankLines="1" />

	          A server MAY generate a Persistent-auth request as soon as it knows that
	          the requested authentication scheme will authenticate the session. The client
	          CANNOT make any assumptions by the absence of the Persistent-auth header, until the
	          authentication process is complete and it receives the final server response
	          containing the requested resource.
        	</t>
        	

        </list>
    </t>


    <section title="Auth-ID Header and Security Context Lifetime">

 				<t>
              Servers create and store security context information when they create the
               Auth-ID header. An Auth-ID header CANNOT be reused across sessions.
				</t>

				<t>
               The Auth-ID mapping is destroyed when the authentication process completes.
               Completion of the authentication process can be a successful authentication
               or failure to authenticate. TBD: Should Auth-IDs be random numbers? The
               security vs look-up perf implications should be weighed.
				</t>

 				<t>
              Servers SHOULD limit the number of incomplete security contexts per
               session, to protect against misbehaving clients that cause the server to
               create multiple authentication contexts but never complete the authentication
               process. Servers SHOULD define a maximum number of incomplete security
               contexts and ignore SYN streams from misbehaving clients. 
				</t>
                
 				<t>
              Per-session security contexts are transient and servers SHOULD discard them
               when request processing completes. There SHOULD only be one complete security
               context open per session.
				</t>
    </section>


</section>

<section title="Stateful Authentication to Proxies">
	<t>
       HTTP proxies MUST add a new Remote-http-version header to inform the client of the
       HTTP version of the remote host. HTTP 2.0 clients can make authentication decisions
       based on the HTTP version of the target server. Proxy and gateway applications should
       take the consideration outlined by RFC 2616 when forwarding messages between client
       and servers with different protocol version capabilities.
	</t>

    <section title="HTTP 2.0 Client Authenticating to an HTTP 2.0 Server via Proxy">
      <t>
              Authentication from an HTTP 2.0 (or greater) client to an HTTP 2.0 (or
               greater) server will work without additional changes, other than those
               described in the Multilegged Authentication for HTTP multiplexing proposal
               section of this document. Proxies MUST bind the client-to-proxy and 
               proxy-to-server connections.
      </t>
    </section>
    
      <section title="HTTP 2.0 Client Authenticating to an HTTP 1.1 Server via Proxy">

  				<t>
              HTTP 2.0 (or greater) clients that establish an authenticated connection to an
               HTTP 1.1 server (via a proxy) SHOULD downgrade HTTP version to HTTP 1.1, to
               avoid serialization. 
				</t>

  				<t>
              HTTP 2.0 clients can multiplex streams within the authenticated HTTP 2.0
               client-proxy session, but the proxy MUST serialize requests through the
               authenticated HTTP 1.1 proxy-server connection.
				</t>

  				<t>
              HTTP 2.0 clients could decide to downgrade all requests requiring
               authentication (via a proxy) to HTTP 1.1 servers or only downgrade
               authenticated sessions, as indicated by the presence of the Persisted-auth
               header.
				</t>

    </section>

    <section title="HTTP 1.1 Client Connecting to an HTTP 2.0 Server via Proxy">
      <t>
               No changes required to support this scenario as HTTP 1.1 clients ignore
               HTTP 2.0 headers.
      </t>
    </section>
    
</section>

<section title="Authentication and multi-host sessions">
      <t>
       The proposed authentication mechanism works only if there is a limit of one unique
       host per HTTP 2.0 session.
      </t>
</section>
    

<section title="Security Considerations">
      <t>
   Implementers should be aware of the security considerations defined by the individual
   authentication schemes supported. The following are some general security considerations
   that are independent of the proposed authentication mechanism.
      </t>
      <t>
   The proposed authentication mechanism is only used to provide authentication of a user to
   a server.  It provides no facilities for protecting the HTTP headers or data including the
   Authorization and WWW-Authenticate headers that are used to implement this mechanism.
      </t>
      <t>
   Alternate mechanisms such as TLS can be used to provide confidentiality. Hashes of the TLS
   certificates can be used as channel bindings to secure the channel.  In this case clients
   would need to enforce that the channel binding information is valid.  
      </t>
      <t>
   If an HTTP proxy is used between the client and server, it MUST take care to not share
   authenticated connections between different authenticated clients to the same server.  If
   this is not honored, then the server can easily lose track of security context
   associations.  
      </t>   
      <t>
   A proxy that correctly honors client to server authentication integrity will supply the
   "Proxy-support:  Session-Based-Authentication" HTTP header to the client in HTTP responses
   from the proxy.  

      </t>
</section>
    
    <section title="Acknowledgements">
      <t>Thanks to the following individuals who provided helpful feedback
         and contributed to discussions on this document: Paul Leach, Nathan Ide 
         and Rob Trace.
      </t>
    </section>
  </middle>

  <back>
  </back>
</rfc>

