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