netwerk/protocol/http/nsIHttpChannelAuthProvider.idl

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim: set sw=2 ts=8 et tw=80 : */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #include "nsICancelable.idl"
     9 interface nsIHttpChannel;
    10 interface nsIHttpAuthenticableChannel;
    12 /**
    13  * nsIHttpChannelAuthProvider
    14  *
    15  * This interface is intended for providing authentication for http-style
    16  * channels, like nsIHttpChannel and nsIWebSocket, which implement the
    17  * nsIHttpAuthenticableChannel interface.
    18  *
    19  * When requesting pages AddAuthorizationHeaders MUST be called
    20  * in order to get the http cached headers credentials. When the request is
    21  * unsuccessful because of receiving either a 401 or 407 http response code
    22  * ProcessAuthentication MUST be called and the page MUST be requested again
    23  * with the new credentials that the user has provided. After a successful
    24  * request, checkForSuperfluousAuth MAY be called, and disconnect MUST be
    25  * called.
    26  */
    28 [scriptable, uuid(c68f3def-c7c8-4ee8-861c-eef49a48b702)]
    29 interface nsIHttpChannelAuthProvider : nsICancelable
    30 {
    31   /**
    32    * Initializes the http authentication support for the channel.
    33    * Implementations must hold a weak reference of the channel.
    34    */
    35   void init(in nsIHttpAuthenticableChannel channel);
    37   /**
    38    * Upon receipt of a server challenge, this function is called to determine
    39    * the credentials to send.
    40    *
    41    * @param httpStatus
    42    *        the http status received.
    43    * @param sslConnectFailed
    44    *        if the last ssl tunnel connection attempt was or not successful.
    45    * @param callback
    46    *        the callback to be called when it returns NS_ERROR_IN_PROGRESS.
    47    *        The implementation must hold a weak reference.
    48    *
    49    * @returns NS_OK if the credentials were got and set successfully.
    50    *          NS_ERROR_IN_PROGRESS if the credentials are going to be asked to
    51    *                               the user. The channel reference must be
    52    *                               alive until the feedback from
    53    *                               nsIHttpAuthenticableChannel's methods or
    54    *                               until disconnect be called.
    55    */
    56   void processAuthentication(in unsigned long httpStatus,
    57                              in boolean sslConnectFailed);
    59   /**
    60    * Add credentials from the http auth cache.
    61    */
    62   void addAuthorizationHeaders();
    64   /**
    65    * Check if an unnecessary(and maybe malicious) url authentication has been
    66    * provided.
    67    */
    68   void checkForSuperfluousAuth();
    70   /**
    71    * Cancel pending user auth prompts and release the callback and channel
    72    * weak references.
    73    */
    74   void disconnect(in nsresult status);
    75 };

mercurial