Bug 1814798 - pt 2. Add a PHCManager component to control PHC r=glandium,emilio
[gecko.git] / netwerk / protocol / http / nsIHttpChannelAuthProvider.idl
blob67a1ae217de9987bafdb3cd625069fc5a6bf3c31
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
15 * This interface is intended for providing authentication for http-style
16 * channels, like nsIHttpChannel and nsIWebSocket, which implement the
17 * nsIHttpAuthenticableChannel interface.
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.
28 [uuid(788f331b-2e1f-436c-b405-4f88a31a105b)]
29 interface nsIHttpChannelAuthProvider : nsICancelable
31 /**
32 * Initializes the http authentication support for the channel.
33 * Implementations must hold a weak reference of the channel.
35 [must_use] void init(in nsIHttpAuthenticableChannel channel);
37 /**
38 * Upon receipt of a server challenge, this function is called to determine
39 * the credentials to send.
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.
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.
56 [must_use] void processAuthentication(in unsigned long httpStatus,
57 in boolean sslConnectFailed);
59 /**
60 * Add credentials from the http auth cache.
62 * @param dontUseCachedWWWCreds
63 * When true, the method will not add any Authorization headers from
64 * the auth cache.
66 [must_use] void addAuthorizationHeaders(in boolean dontUseCachedWWWCreds);
68 /**
69 * Check if an unnecessary(and maybe malicious) url authentication has been
70 * provided.
72 [must_use] void checkForSuperfluousAuth();
74 /**
75 * Cancel pending user auth prompts and release the callback and channel
76 * weak references.
78 [must_use] void disconnect(in nsresult status);
80 /**
81 * Clear the proxy ident to not consider it invalid on re-athentication.
82 * Called when the channel finds out its transaction has been internally
83 * restarted.
85 void clearProxyIdent();